Cordapps now have a name field (#1645)

* Cordapps now have a name field.
This commit is contained in:
Clinton 2017-09-26 17:15:11 +01:00 committed by GitHub
parent 35924ba737
commit 24ff7efd5f
4 changed files with 8 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import java.net.URL
*
* This will only need to be constructed manually for certain kinds of tests.
*
* @property name Cordapp name - derived from the base name of the Cordapp JAR (therefore may not be unique)
* @property contractClassNames List of contracts
* @property initiatedFlows List of initiatable flow classes
* @property rpcFlows List of RPC initiable flows classes
@ -22,6 +23,7 @@ import java.net.URL
* @property jarPath The path to the JAR for this CorDapp
*/
interface Cordapp {
val name: String
val contractClassNames: List<String>
val initiatedFlows: List<Class<out FlowLogic<*>>>
val rpcFlows: List<Class<out FlowLogic<*>>>

View File

@ -5,6 +5,7 @@ import net.corda.core.flows.FlowLogic
import net.corda.core.node.CordaPluginRegistry
import net.corda.core.schemas.MappedSchema
import net.corda.core.serialization.SerializeAsToken
import java.io.File
import java.net.URL
data class CordappImpl(
@ -15,6 +16,8 @@ data class CordappImpl(
override val plugins: List<CordaPluginRegistry>,
override val customSchemas: Set<MappedSchema>,
override val jarPath: URL) : Cordapp {
override val name: String = File(jarPath.toURI()).name.removeSuffix(".jar")
/**
* An exhaustive list of all classes relevant to the node within this CorDapp
*

View File

@ -7,6 +7,8 @@ from the previous milestone release.
UNRELEASED
----------
* ``Cordapp`` now has a name field for identifying CorDapps and all CorDapp names are printed to console at startup.
Release 1.0
-----------

View File

@ -263,6 +263,7 @@ open class NodeStartup(val args: Array<String>) {
node.configuration.extraAdvertisedServiceIds.let {
if (it.isNotEmpty()) Node.printBasicNodeInfo("Providing network services", it.joinToString())
}
Node.printBasicNodeInfo("Loaded CorDapps", node.cordappProvider.cordapps.map { it.name }.joinToString())
val plugins = node.pluginRegistries
.map { it.javaClass.name }
.filterNot { it.startsWith("net.corda.node.") || it.startsWith("net.corda.core.") || it.startsWith("net.corda.nodeapi.") }