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: 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())
|
||||
|
||||
// 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]
|
||||
*/
|
||||
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.StateMachineUpdate
|
||||
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.StateMachineTransactionMapping
|
||||
import net.corda.core.node.services.Vault
|
||||
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.startFlowPermission
|
||||
import net.corda.node.services.statemachine.FlowStateMachineImpl
|
||||
@ -35,9 +35,9 @@ import java.util.*
|
||||
* thread (i.e. serially). Arguments are serialised and deserialised automatically.
|
||||
*/
|
||||
class CordaRPCOpsImpl(
|
||||
val services: ServiceHub,
|
||||
val smm: StateMachineManager,
|
||||
val database: Database
|
||||
private val services: ServiceHubInternal,
|
||||
private val smm: StateMachineManager,
|
||||
private val database: Database
|
||||
) : CordaRPCOps {
|
||||
override val protocolVersion: Int get() = 0
|
||||
|
||||
@ -144,6 +144,8 @@ class CordaRPCOpsImpl(
|
||||
override fun partyFromKey(key: CompositeKey) = services.identityService.partyFromKey(key)
|
||||
override fun partyFromName(name: String) = services.identityService.partyFromName(name)
|
||||
|
||||
override fun registeredFlows(): List<String> = services.flowLogicRefFactory.flowWhitelist.keys.sorted()
|
||||
|
||||
companion object {
|
||||
private fun stateMachineInfoFromFlowLogic(id: StateMachineRunId, flowLogic: FlowLogic<*>): StateMachineInfo {
|
||||
return StateMachineInfo(id, flowLogic.javaClass.name, flowLogic.track())
|
||||
|
Reference in New Issue
Block a user