mirror of
https://github.com/corda/corda.git
synced 2025-06-19 07:38:22 +00:00
Clock now instantiates via reflection to allow demo clocks to be passed in.
This commit is contained in:
@ -305,7 +305,8 @@ open class DriverDSL(
|
|||||||
"artemisAddress" to messagingAddress.toString(),
|
"artemisAddress" to messagingAddress.toString(),
|
||||||
"webAddress" to apiAddress.toString(),
|
"webAddress" to apiAddress.toString(),
|
||||||
"extraAdvertisedServiceIds" to advertisedServices.joinToString(","),
|
"extraAdvertisedServiceIds" to advertisedServices.joinToString(","),
|
||||||
"networkMapAddress" to networkMapAddress.toString()
|
"networkMapAddress" to networkMapAddress.toString(),
|
||||||
|
"clockClass" to clock.javaClass.name
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -333,7 +334,8 @@ open class DriverDSL(
|
|||||||
"basedir" to Paths.get(nodeDirectory).normalize().toString(),
|
"basedir" to Paths.get(nodeDirectory).normalize().toString(),
|
||||||
"artemisAddress" to networkMapAddress.toString(),
|
"artemisAddress" to networkMapAddress.toString(),
|
||||||
"webAddress" to apiAddress.toString(),
|
"webAddress" to apiAddress.toString(),
|
||||||
"extraAdvertisedServiceIds" to ""
|
"extraAdvertisedServiceIds" to "",
|
||||||
|
"clockClass" to clock.javaClass.name
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ interface NodeConfiguration : NodeSSLConfiguration {
|
|||||||
val devMode: Boolean
|
val devMode: Boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
class FullNodeConfiguration(config: Config, val clock: Clock = NodeClock()) : NodeConfiguration {
|
class FullNodeConfiguration(config: Config) : NodeConfiguration {
|
||||||
override val basedir: Path by config
|
override val basedir: Path by config
|
||||||
override val myLegalName: String by config
|
override val myLegalName: String by config
|
||||||
override val nearestCity: String by config
|
override val nearestCity: String by config
|
||||||
@ -48,6 +48,7 @@ class FullNodeConfiguration(config: Config, val clock: Clock = NodeClock()) : No
|
|||||||
val webAddress: HostAndPort by config
|
val webAddress: HostAndPort by config
|
||||||
val messagingServerAddress: HostAndPort? by config.getOrElse { null }
|
val messagingServerAddress: HostAndPort? by config.getOrElse { null }
|
||||||
val extraAdvertisedServiceIds: String by config
|
val extraAdvertisedServiceIds: String by config
|
||||||
|
val clockClass: String? by config.getOrElse { null }
|
||||||
|
|
||||||
fun createNode(): Node {
|
fun createNode(): Node {
|
||||||
val advertisedServices = mutableSetOf<ServiceInfo>()
|
val advertisedServices = mutableSetOf<ServiceInfo>()
|
||||||
@ -58,7 +59,11 @@ class FullNodeConfiguration(config: Config, val clock: Clock = NodeClock()) : No
|
|||||||
}
|
}
|
||||||
if (networkMapAddress == null) advertisedServices.add(ServiceInfo(NetworkMapService.type))
|
if (networkMapAddress == null) advertisedServices.add(ServiceInfo(NetworkMapService.type))
|
||||||
val networkMapMessageAddress: SingleMessageRecipient? = if (networkMapAddress == null) null else NodeMessagingClient.makeNetworkMapAddress(networkMapAddress!!)
|
val networkMapMessageAddress: SingleMessageRecipient? = if (networkMapAddress == null) null else NodeMessagingClient.makeNetworkMapAddress(networkMapAddress!!)
|
||||||
return Node(this, networkMapMessageAddress, advertisedServices, clock)
|
return if(clockClass != null) {
|
||||||
|
Node(this, networkMapMessageAddress, advertisedServices, Class.forName(clockClass).newInstance() as Clock)
|
||||||
|
} else {
|
||||||
|
Node(this, networkMapMessageAddress, advertisedServices)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user