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 Apr 30, 2024
1 parent 6be6447 commit 0eb899e
Show file tree
Hide file tree
Showing 68 changed files with 4,905 additions and 107 deletions.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ 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/CPIV1Response.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIV1ResponseCpisInner.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIV1ResponseCpisInnerCpksInner.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 +21,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/FlowStatusV1Response.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/FlowV5Error.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/GetFlowV1Request.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 @@ -34,6 +43,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
@@ -1,19 +1,25 @@
package org.hyperledger.cactus.plugin.ledger.connector.corda.server.api

import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.CPIV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ClearMonitorTransactionsV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ClearMonitorTransactionsV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DeployContractJarsBadRequestV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DeployContractJarsSuccessV1Response
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.FlowStatusV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.FlowStatusV1Responses
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.GetFlowV1Request
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.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 +85,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 getFlowV1Request: GetFlowV1Request): ResponseEntity<FlowStatusV1Response> {
return ResponseEntity(service.getFlowV1(getFlowV1Request), 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 +128,27 @@ 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"]
)
fun listCPIV1(): ResponseEntity<CPIV1Response> {
return ResponseEntity(service.listCPIV1(), 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 getFlowV1Request: GetFlowV1Request): ResponseEntity<FlowStatusV1Responses> {
return ResponseEntity(service.listFlowV1(getFlowV1Request), HttpStatus.valueOf(200))
}


@RequestMapping(
method = [RequestMethod.POST],
value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/list-flows"],
Expand All @@ -133,6 +171,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
@@ -1,19 +1,25 @@
package org.hyperledger.cactus.plugin.ledger.connector.corda.server.api

import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.CPIV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ClearMonitorTransactionsV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ClearMonitorTransactionsV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DeployContractJarsBadRequestV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DeployContractJarsSuccessV1Response
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.FlowStatusV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.FlowStatusV1Responses
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.GetFlowV1Request
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.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 +56,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 getFlowV1Request 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(getFlowV1Request: GetFlowV1Request): FlowStatusV1Response

/**
* GET /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/get-monitor-transactions : Get transactions for monitored state classes.
*
Expand All @@ -76,6 +93,25 @@ 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
*
* @return OK (status code 200)
* @see ApiPluginLedgerConnectorCorda#listCPIV1
*/
fun listCPIV1(): CPIV1Response

/**
* 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 getFlowV1Request 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(getFlowV1Request: GetFlowV1Request): 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 +132,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,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 CPIIDV5(

@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.CPIV1ResponseCpisInner
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 cpis
*/
data class CPIV1Response(

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

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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.CPIIDV1
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.CPIV1ResponseCpisInnerCpksInner
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 cpiFileChecksum
* @param cpiFileFullChecksum
* @param cpks
* @param groupPolicy
* @param id
* @param timestamp
*/
data class CPIV1ResponseCpisInner(

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

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

@field:Valid
@get:JsonProperty("cpks") val cpks: kotlin.collections.List<CPIV1ResponseCpisInnerCpksInner>? = null,

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

@field:Valid
@get:JsonProperty("id") val id: CPIIDV1? = null,

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

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
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.CPIIDV1
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 hash
* @param id
* @param libraries
* @param mainBundle
* @param timestamp
* @param type
*/
data class CPIV1ResponseCpisInnerCpksInner(

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

@field:Valid
@get:JsonProperty("id") val id: CPIIDV1? = null,

@get:JsonProperty("libraries") val libraries: kotlin.collections.List<kotlin.String>? = null,

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

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

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

}
Loading

0 comments on commit 0eb899e

Please sign in to comment.