mirror of
https://github.com/corda/corda.git
synced 2025-04-07 11:27:01 +00:00
Clock now instantiates via reflection to allow demo clocks to be passed in.
This commit is contained in:
parent
622b5cabf7
commit
54e002f654
@ -305,7 +305,8 @@ open class DriverDSL(
|
||||
"artemisAddress" to messagingAddress.toString(),
|
||||
"webAddress" to apiAddress.toString(),
|
||||
"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(),
|
||||
"artemisAddress" to networkMapAddress.toString(),
|
||||
"webAddress" to apiAddress.toString(),
|
||||
"extraAdvertisedServiceIds" to ""
|
||||
"extraAdvertisedServiceIds" to "",
|
||||
"clockClass" to clock.javaClass.name
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -32,7 +32,7 @@ interface NodeConfiguration : NodeSSLConfiguration {
|
||||
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 myLegalName: 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 messagingServerAddress: HostAndPort? by config.getOrElse { null }
|
||||
val extraAdvertisedServiceIds: String by config
|
||||
val clockClass: String? by config.getOrElse { null }
|
||||
|
||||
fun createNode(): Node {
|
||||
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))
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user