Skip to content

Commit

Permalink
feat(corda): support 5.1 via TS/HTTP (no JVM)
Browse files Browse the repository at this point in the history
Fixes hyperledger-cacti#2978

Signed-off-by: adrianbatuto <[email protected]>
  • Loading branch information
adrianbatuto committed Jun 8, 2024
1 parent 6be6447 commit 7a03e5d
Show file tree
Hide file tree
Showing 55 changed files with 4,655 additions and 108 deletions.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ settings.gradle
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/api/ApiPluginLedgerConnectorCordaController.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/api/ApiPluginLedgerConnectorCordaService.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/api/ApiUtil.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIIDV1.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/ClearMonitorTransactionsV1Request.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/ClearMonitorTransactionsV1Response.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CordaNodeSshCredentials.kt
Expand All @@ -17,6 +18,11 @@ src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/mode
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/DiagnoseNodeV1Request.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/DiagnoseNodeV1Response.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowInvocationType.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatusV1Responses.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatusV1ResponsesFlowStatusResponsesInner.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowV1Error.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/GetFlowCidV1Request.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/GetFlowCidV1Response.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/GetMonitorTransactionsV1Request.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/GetMonitorTransactionsV1Response.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/GetMonitorTransactionsV1ResponseTxInner.kt
Expand All @@ -26,6 +32,10 @@ src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/mode
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/JvmObject.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/JvmType.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/JvmTypeKind.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/ListCpiV1Request.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/ListCpiV1Response.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/ListCpiV1ResponseCpisInner.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/ListCpiV1ResponseCpisInnerCpksInner.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/ListFlowsV1Request.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/ListFlowsV1Response.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/NetworkHostAndPort.kt
Expand All @@ -34,6 +44,9 @@ src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/mode
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/Party.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/PublicKey.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/SHA256.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/StartFlowV1Request.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/StartFlowV1RequestRequestBody.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/StartFlowV1Response.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/StartMonitorV1Request.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/StartMonitorV1Response.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/StopMonitorV1Request.kt
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,20 @@ import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DeployC
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DeployContractJarsV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DiagnoseNodeV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DiagnoseNodeV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.FlowStatusV1Responses
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.GetFlowCidV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.GetFlowCidV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.GetMonitorTransactionsV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.GetMonitorTransactionsV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.InvokeContractV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.InvokeContractV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ListCpiV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ListCpiV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ListFlowsV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ListFlowsV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.NodeInfo
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StartFlowV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StartFlowV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StartMonitorV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StartMonitorV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StopMonitorV1Request
Expand Down Expand Up @@ -79,6 +86,17 @@ class ApiPluginLedgerConnectorCordaController(@Autowired(required = true) val se
}


@RequestMapping(
method = [RequestMethod.GET],
value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/getFlowCid"],
produces = ["text/plain"],
consumes = ["application/json"]
)
fun getFlowV1( @Valid @RequestBody getFlowCidV1Request: GetFlowCidV1Request): ResponseEntity<GetFlowCidV1Response> {
return ResponseEntity(service.getFlowV1(getFlowCidV1Request), HttpStatus.valueOf(200))
}


@RequestMapping(
method = [RequestMethod.GET],
value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/get-monitor-transactions"],
Expand Down Expand Up @@ -111,6 +129,28 @@ class ApiPluginLedgerConnectorCordaController(@Autowired(required = true) val se
}


@RequestMapping(
method = [RequestMethod.GET],
value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/listCPI"],
produces = ["application/json"],
consumes = ["application/json"]
)
fun listCpiV1( @Valid @RequestBody listCpiV1Request: ListCpiV1Request): ResponseEntity<ListCpiV1Response> {
return ResponseEntity(service.listCpiV1(listCpiV1Request), HttpStatus.valueOf(200))
}


@RequestMapping(
method = [RequestMethod.GET],
value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/listFlows"],
produces = ["text/plain"],
consumes = ["application/json"]
)
fun listFlowV1( @Valid @RequestBody getFlowCidV1Request: GetFlowCidV1Request): ResponseEntity<FlowStatusV1Responses> {
return ResponseEntity(service.listFlowV1(getFlowCidV1Request), HttpStatus.valueOf(200))
}


@RequestMapping(
method = [RequestMethod.POST],
value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/list-flows"],
Expand All @@ -133,6 +173,17 @@ class ApiPluginLedgerConnectorCordaController(@Autowired(required = true) val se
}


@RequestMapping(
method = [RequestMethod.POST],
value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/startFlow"],
produces = ["application/json"],
consumes = ["application/json"]
)
fun startFlowV1( @Valid @RequestBody startFlowV1Request: StartFlowV1Request): ResponseEntity<StartFlowV1Response> {
return ResponseEntity(service.startFlowV1(startFlowV1Request), HttpStatus.valueOf(200))
}


@RequestMapping(
method = [RequestMethod.POST],
value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/start-monitor"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,20 @@ import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DeployC
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DeployContractJarsV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DiagnoseNodeV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DiagnoseNodeV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.FlowStatusV1Responses
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.GetFlowCidV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.GetFlowCidV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.GetMonitorTransactionsV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.GetMonitorTransactionsV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.InvokeContractV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.InvokeContractV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ListCpiV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ListCpiV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ListFlowsV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ListFlowsV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.NodeInfo
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StartFlowV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StartFlowV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StartMonitorV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StartMonitorV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StopMonitorV1Request
Expand Down Expand Up @@ -50,6 +57,17 @@ interface ApiPluginLedgerConnectorCordaService {
*/
fun diagnoseNodeV1(diagnoseNodeV1Request: DiagnoseNodeV1Request?): DiagnoseNodeV1Response

/**
* GET /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/getFlowCid : This method gets the current status of the specified flow instance.
*
* @param getFlowCidV1Request This method gets the current status of the specified flow instance. (required)
* @return OK (status code 200)
* or Unauthorized (status code 401)
* or Forbidden (status code 403)
* @see ApiPluginLedgerConnectorCorda#getFlowV1
*/
fun getFlowV1(getFlowCidV1Request: GetFlowCidV1Request): GetFlowCidV1Response

/**
* GET /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/get-monitor-transactions : Get transactions for monitored state classes.
*
Expand All @@ -76,6 +94,26 @@ interface ApiPluginLedgerConnectorCordaService {
*/
fun invokeContractV1(invokeContractV1Request: InvokeContractV1Request?): InvokeContractV1Response

/**
* GET /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/listCPI : List all CPIs uploaded to the cluster
*
* @param listCpiV1Request (required)
* @return OK (status code 200)
* @see ApiPluginLedgerConnectorCorda#listCpiV1
*/
fun listCpiV1(listCpiV1Request: ListCpiV1Request): ListCpiV1Response

/**
* GET /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/listFlows : This method returns an array containing the statuses of all flows running for a specified holding identity. An empty array is returned if there are no flows running.
*
* @param getFlowCidV1Request This method gets the current status of the specified flow instance. (required)
* @return OK (status code 200)
* or Unauthorized (status code 401)
* or Forbidden (status code 403)
* @see ApiPluginLedgerConnectorCorda#listFlowV1
*/
fun listFlowV1(getFlowCidV1Request: GetFlowCidV1Request): FlowStatusV1Responses

/**
* POST /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/list-flows
* Responds with a list of the flows on the Corda node.
Expand All @@ -96,6 +134,15 @@ interface ApiPluginLedgerConnectorCordaService {
*/
fun networkMapV1(body: kotlin.Any?): List<NodeInfo>

/**
* POST /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/startFlow : This method starts a new instance for the specified flow for the specified holding identity.
*
* @param startFlowV1Request Request body for starting a flow (required)
* @return OK (status code 200)
* @see ApiPluginLedgerConnectorCorda#startFlowV1
*/
fun startFlowV1(startFlowV1Request: StartFlowV1Request): StartFlowV1Response

/**
* POST /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/start-monitor : Start monitoring corda changes (transactions) of given state class
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.hyperledger.cactus.plugin.ledger.connector.corda.server.model

import java.util.Objects
import com.fasterxml.jackson.annotation.JsonProperty
import javax.validation.constraints.DecimalMax
import javax.validation.constraints.DecimalMin
import javax.validation.constraints.Email
import javax.validation.constraints.Max
import javax.validation.constraints.Min
import javax.validation.constraints.NotNull
import javax.validation.constraints.Pattern
import javax.validation.constraints.Size
import javax.validation.Valid

/**
*
* @param name
* @param version
* @param signerSummaryHash
*/
data class CPIIDV1(

@get:JsonProperty("name", required = true) val name: kotlin.String,

@get:JsonProperty("version", required = true) val version: kotlin.String,

@get:JsonProperty("signerSummaryHash") val signerSummaryHash: kotlin.String? = null
) {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package org.hyperledger.cactus.plugin.ledger.connector.corda.server.model

import java.util.Objects
import com.fasterxml.jackson.annotation.JsonProperty
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.FlowStatusV1ResponsesFlowStatusResponsesInner
import javax.validation.constraints.DecimalMax
import javax.validation.constraints.DecimalMin
import javax.validation.constraints.Email
import javax.validation.constraints.Max
import javax.validation.constraints.Min
import javax.validation.constraints.NotNull
import javax.validation.constraints.Pattern
import javax.validation.constraints.Size
import javax.validation.Valid

/**
*
* @param flowStatusResponses
*/
data class FlowStatusV1Responses(

@field:Valid
@get:JsonProperty("flowStatusResponses") val flowStatusResponses: kotlin.collections.List<FlowStatusV1ResponsesFlowStatusResponsesInner>? = null
) {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package org.hyperledger.cactus.plugin.ledger.connector.corda.server.model

import java.util.Objects
import com.fasterxml.jackson.annotation.JsonProperty
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.FlowV1Error
import javax.validation.constraints.DecimalMax
import javax.validation.constraints.DecimalMin
import javax.validation.constraints.Email
import javax.validation.constraints.Max
import javax.validation.constraints.Min
import javax.validation.constraints.NotNull
import javax.validation.constraints.Pattern
import javax.validation.constraints.Size
import javax.validation.Valid

/**
*
* @param clientRequestId
* @param flowError
* @param flowId
* @param flowResult
* @param flowStatus
* @param holdingIDShortHash
* @param timestamp
*/
data class FlowStatusV1ResponsesFlowStatusResponsesInner(

@get:JsonProperty("clientRequestId") val clientRequestId: kotlin.String? = null,

@field:Valid
@get:JsonProperty("flowError") val flowError: FlowV1Error? = null,

@get:JsonProperty("flowId") val flowId: kotlin.String? = null,

@get:JsonProperty("flowResult") val flowResult: kotlin.String? = null,

@get:JsonProperty("flowStatus") val flowStatus: kotlin.String? = null,

@get:JsonProperty("holdingIDShortHash") val holdingIDShortHash: kotlin.String? = null,

@get:JsonProperty("timestamp") val timestamp: java.time.OffsetDateTime? = null
) {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.hyperledger.cactus.plugin.ledger.connector.corda.server.model

import java.util.Objects
import com.fasterxml.jackson.annotation.JsonProperty
import javax.validation.constraints.DecimalMax
import javax.validation.constraints.DecimalMin
import javax.validation.constraints.Email
import javax.validation.constraints.Max
import javax.validation.constraints.Min
import javax.validation.constraints.NotNull
import javax.validation.constraints.Pattern
import javax.validation.constraints.Size
import javax.validation.Valid

/**
*
* @param message
* @param type
*/
data class FlowV1Error(

@get:JsonProperty("message", required = true) val message: kotlin.String,

@get:JsonProperty("type", required = true) val type: kotlin.String
) {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.hyperledger.cactus.plugin.ledger.connector.corda.server.model

import java.util.Objects
import com.fasterxml.jackson.annotation.JsonProperty
import javax.validation.constraints.DecimalMax
import javax.validation.constraints.DecimalMin
import javax.validation.constraints.Email
import javax.validation.constraints.Max
import javax.validation.constraints.Min
import javax.validation.constraints.NotNull
import javax.validation.constraints.Pattern
import javax.validation.constraints.Size
import javax.validation.Valid

/**
* This method gets the current status of the specified flow instance.
* @param username
* @param password
* @param baseUrl
* @param holdingIDShortHash
* @param clientRequestId
*/
data class GetFlowCidV1Request(

@get:JsonProperty("username", required = true) val username: kotlin.String,

@get:JsonProperty("password", required = true) val password: kotlin.String,

@get:JsonProperty("baseUrl", required = true) val baseUrl: kotlin.String,

@get:JsonProperty("holdingIDShortHash") val holdingIDShortHash: kotlin.String? = null,

@get:JsonProperty("clientRequestId") val clientRequestId: kotlin.String? = null
) {

}
Loading

0 comments on commit 7a03e5d

Please sign in to comment.