diff options
author | 2020-09-22 19:05:47 +0000 | |
---|---|---|
committer | 2020-09-22 19:05:47 +0000 | |
commit | e515a85125e5487ecd3f7127b6af0b192d4a0993 (patch) | |
tree | 1fe08a7d54c28419a44845634037d77f8c434a4b /ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org | |
parent | 85d8f7f7701570fb745c3d6360d500f97bdf1b25 (diff) | |
parent | 1072867dfac0df993cbd3e44bcc11a5cac7465fd (diff) |
Merge "Enabling Code Formatter"
Diffstat (limited to 'ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org')
4 files changed, 42 insertions, 6 deletions
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt index a86dcc40f..2a4d05dcb 100644 --- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt @@ -36,6 +36,7 @@ import org.springframework.stereotype.Service open class BluePrintCoreConfiguration(private val bluePrintPropertiesService: BluePrintPropertiesService) { companion object { + const val PREFIX_BLUEPRINT_PROCESSOR = "blueprintsprocessor" } @@ -60,6 +61,7 @@ open class BluePrintPropertyConfiguration { @Service open class BluePrintPropertiesService(private var bluePrintPropertyConfig: BluePrintPropertyConfiguration) { + private val log = logger(BluePrintPropertiesService::class) fun <T> propertyBeanType(prefix: String, type: Class<T>): T { diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt index 58d0f13c2..61997061b 100644 --- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt @@ -34,40 +34,51 @@ import java.util.UUID */ open class ExecutionServiceInput { + @get:ApiModelProperty(required = false, hidden = true) var correlationUUID: String = UUID.randomUUID().toString() + @get:ApiModelProperty(required = true, value = "Headers providing request context.") lateinit var commonHeader: CommonHeader + @get:ApiModelProperty(required = true, value = "Provide information about the action to execute.") lateinit var actionIdentifiers: ActionIdentifiers + @get:ApiModelProperty( required = true, value = "Contain the information to be passed as input to the action." + - "The payload is constituted of two section: the workflow input which is the higher level block (xxx-request)" + - " and the input for resource resolution located within the xxx-request block, contained within xxx-properties" + "The payload is constituted of two section: the workflow input which is the higher level block (xxx-request)" + + " and the input for resource resolution located within the xxx-request block, contained within xxx-properties" ) lateinit var payload: ObjectNode + @get:ApiModelProperty(hidden = true) @get:JsonIgnore var stepData: StepData? = null } open class ExecutionServiceOutput { + @get:ApiModelProperty(required = false, hidden = true) var correlationUUID: String? = null + @get:ApiModelProperty(required = true, value = "Headers providing request context.") lateinit var commonHeader: CommonHeader + @get:ApiModelProperty(required = true, value = "Provide information about the action to execute.") lateinit var actionIdentifiers: ActionIdentifiers + @get:ApiModelProperty(required = true, value = "Status of the request.") lateinit var status: Status + @get:ApiModelProperty( required = true, value = "Contain the information to be passed as input to the action." + - "The payload is constituted of two section: the workflow input which is the higher level block (xxx-request)" + - " and the input for resource resolution located within the xxx-request block, contained within xxx-properties" + "The payload is constituted of two section: the workflow input which is the higher level block (xxx-request)" + + " and the input for resource resolution located within the xxx-request block, contained within xxx-properties" ) lateinit var payload: ObjectNode + @get:ApiModelProperty(hidden = true) @get:JsonIgnore var stepData: StepData? = null @@ -77,12 +88,16 @@ const val ACTION_MODE_ASYNC = "async" const val ACTION_MODE_SYNC = "sync" open class ActionIdentifiers { + @get:ApiModelProperty(required = false, value = "Name of the CBA.") lateinit var blueprintName: String + @get:ApiModelProperty(required = false, value = "Version of the CBA.") lateinit var blueprintVersion: String + @get:ApiModelProperty(required = true, value = "Name of the workflow to execute.") lateinit var actionName: String + @get:ApiModelProperty( required = true, value = "Async processing is only supported for gRPC client.", @@ -92,31 +107,41 @@ open class ActionIdentifiers { } open class CommonHeader { + @get:ApiModelProperty(required = true, value = "Date of the execution", example = "2012-04-23T18:25:43.511Z") @get:JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") var timestamp: Date = Date() + @get:ApiModelProperty(required = true, value = "Identify the system/person triggering the request.") lateinit var originatorId: String + @get:ApiModelProperty(required = true, value = "Uniquely identify a request.") lateinit var requestId: String + @get:ApiModelProperty(required = true, value = "Allow for fine-grain request identifier") lateinit var subRequestId: String + @get:ApiModelProperty(required = false, hidden = true) var flags: Flags? = null } open class Flags { + @get:ApiModelProperty(value = "Whether or not to force the action.") var isForce: Boolean = false + @get:ApiModelProperty(value = "3600") var ttl: Int = 3600 } open class Status { + @get:ApiModelProperty(required = true, value = "HTTP status code equivalent.") var code: Int = 200 + @get:ApiModelProperty(required = true, value = "Type of the event being emitted by CDS.") var eventType: String = EventType.EVENT_COMPONENT_EXECUTED.name + @get:ApiModelProperty( required = true, value = "Time when the execution ended.", @@ -124,13 +149,16 @@ open class Status { ) @get:JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") var timestamp: Date = Date() + @get:ApiModelProperty(required = false, value = "Error message when system failed") var errorMessage: String? = null + @get:ApiModelProperty(required = true, value = "Message providing request status") var message: String = BluePrintConstants.STATUS_SUCCESS } open class StepData { + lateinit var name: String var properties: MutableMap<String, JsonNode> = mutableMapOf() } diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterService.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterService.kt index d3c88d732..5493bac1a 100644 --- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterService.kt +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterService.kt @@ -80,6 +80,7 @@ open class HazelcastClusterService : BluePrintClusterService { ) val configFile = configuration.configFile + /** Check file exists */ val clusterConfigFile = normalizedFile(configuration.configFile) check(clusterConfigFile.absolutePath.endsWith("yaml", true)) { @@ -211,6 +212,7 @@ open class HazelcastClusterService : BluePrintClusterService { open class BlueprintsClusterMembershipListener() : MembershipListener { + private val log = logger(BlueprintsClusterMembershipListener::class) override fun memberRemoved(membershipEvent: MembershipEvent) { @@ -223,6 +225,7 @@ open class BlueprintsClusterMembershipListener() : } open class ClusterLockImpl(private val hazelcast: HazelcastInstance, private val name: String) : ClusterLock { + private val log = logger(ClusterLockImpl::class) private val distributedLock: FencedLock = hazelcast.cpSubsystem.getLock(name) @@ -238,8 +241,10 @@ open class ClusterLockImpl(private val hazelcast: HazelcastInstance, private val override suspend fun tryLock(timeout: Long): Boolean { return distributedLock.tryLock(timeout, TimeUnit.MILLISECONDS) - .also { if (it) log.trace("Cluster lock acquired: $name") - else log.trace("Failed to acquire Cluster lock $name within timeout $timeout") } + .also { + if (it) log.trace("Cluster lock acquired: $name") + else log.trace("Failed to acquire Cluster lock $name within timeout $timeout") + } } override suspend fun unLock() { diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/service/BluePrintClusterService.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/service/BluePrintClusterService.kt index 2d957c289..8cb9f4f92 100644 --- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/service/BluePrintClusterService.kt +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/service/BluePrintClusterService.kt @@ -71,6 +71,7 @@ data class ClusterMember( ) interface ClusterLock { + fun name(): String suspend fun lock() suspend fun fenceLock(): String |