mirror of
https://github.com/corda/corda.git
synced 2025-06-18 15:18:16 +00:00
Add a registeredFlows() RPC that lists the RPCs the node knows about.
This commit is contained in:
@ -24,8 +24,7 @@ import kotlin.reflect.primaryConstructor
|
|||||||
* TODO: Align with API related logic for passing in FlowLogic references (FlowRef)
|
* TODO: Align with API related logic for passing in FlowLogic references (FlowRef)
|
||||||
* TODO: Actual support for AppContext / AttachmentsClassLoader
|
* TODO: Actual support for AppContext / AttachmentsClassLoader
|
||||||
*/
|
*/
|
||||||
class FlowLogicRefFactory(private val flowWhitelist: Map<String, Set<String>>) : SingletonSerializeAsToken() {
|
class FlowLogicRefFactory(val flowWhitelist: Map<String, Set<String>>) : SingletonSerializeAsToken() {
|
||||||
|
|
||||||
constructor() : this(mapOf())
|
constructor() : this(mapOf())
|
||||||
|
|
||||||
// Pending real dependence on AppContext for class loading etc
|
// Pending real dependence on AppContext for class loading etc
|
||||||
|
@ -162,6 +162,9 @@ interface CordaRPCOps : RPCOps {
|
|||||||
* Returns the [Party] with the given name as it's [Party.name]
|
* Returns the [Party] with the given name as it's [Party.name]
|
||||||
*/
|
*/
|
||||||
fun partyFromName(name: String): Party?
|
fun partyFromName(name: String): Party?
|
||||||
|
|
||||||
|
/** Enumerates the class names of the flows that this node knows about. */
|
||||||
|
fun registeredFlows(): List<String>
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,11 +13,11 @@ import net.corda.core.messaging.FlowHandle
|
|||||||
import net.corda.core.messaging.StateMachineInfo
|
import net.corda.core.messaging.StateMachineInfo
|
||||||
import net.corda.core.messaging.StateMachineUpdate
|
import net.corda.core.messaging.StateMachineUpdate
|
||||||
import net.corda.core.node.NodeInfo
|
import net.corda.core.node.NodeInfo
|
||||||
import net.corda.core.node.ServiceHub
|
|
||||||
import net.corda.core.node.services.NetworkMapCache
|
import net.corda.core.node.services.NetworkMapCache
|
||||||
import net.corda.core.node.services.StateMachineTransactionMapping
|
import net.corda.core.node.services.StateMachineTransactionMapping
|
||||||
import net.corda.core.node.services.Vault
|
import net.corda.core.node.services.Vault
|
||||||
import net.corda.core.transactions.SignedTransaction
|
import net.corda.core.transactions.SignedTransaction
|
||||||
|
import net.corda.node.services.api.ServiceHubInternal
|
||||||
import net.corda.node.services.messaging.requirePermission
|
import net.corda.node.services.messaging.requirePermission
|
||||||
import net.corda.node.services.startFlowPermission
|
import net.corda.node.services.startFlowPermission
|
||||||
import net.corda.node.services.statemachine.FlowStateMachineImpl
|
import net.corda.node.services.statemachine.FlowStateMachineImpl
|
||||||
@ -35,9 +35,9 @@ import java.util.*
|
|||||||
* thread (i.e. serially). Arguments are serialised and deserialised automatically.
|
* thread (i.e. serially). Arguments are serialised and deserialised automatically.
|
||||||
*/
|
*/
|
||||||
class CordaRPCOpsImpl(
|
class CordaRPCOpsImpl(
|
||||||
val services: ServiceHub,
|
private val services: ServiceHubInternal,
|
||||||
val smm: StateMachineManager,
|
private val smm: StateMachineManager,
|
||||||
val database: Database
|
private val database: Database
|
||||||
) : CordaRPCOps {
|
) : CordaRPCOps {
|
||||||
override val protocolVersion: Int get() = 0
|
override val protocolVersion: Int get() = 0
|
||||||
|
|
||||||
@ -144,6 +144,8 @@ class CordaRPCOpsImpl(
|
|||||||
override fun partyFromKey(key: CompositeKey) = services.identityService.partyFromKey(key)
|
override fun partyFromKey(key: CompositeKey) = services.identityService.partyFromKey(key)
|
||||||
override fun partyFromName(name: String) = services.identityService.partyFromName(name)
|
override fun partyFromName(name: String) = services.identityService.partyFromName(name)
|
||||||
|
|
||||||
|
override fun registeredFlows(): List<String> = services.flowLogicRefFactory.flowWhitelist.keys.sorted()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private fun stateMachineInfoFromFlowLogic(id: StateMachineRunId, flowLogic: FlowLogic<*>): StateMachineInfo {
|
private fun stateMachineInfoFromFlowLogic(id: StateMachineRunId, flowLogic: FlowLogic<*>): StateMachineInfo {
|
||||||
return StateMachineInfo(id, flowLogic.javaClass.name, flowLogic.track())
|
return StateMachineInfo(id, flowLogic.javaClass.name, flowLogic.track())
|
||||||
|
Reference in New Issue
Block a user