From fac12b4fce74a0b9399139118dece58e76146081 Mon Sep 17 00:00:00 2001 From: Andrius Dagys Date: Wed, 5 Oct 2016 10:50:00 +0100 Subject: [PATCH] Remove NodeConfigurationFromConfig and replace usages with FullNodeConfiguration --- .../main/kotlin/com/r3corda/node/driver/Driver.kt | 5 ++--- .../node/services/config/NodeConfiguration.kt | 12 ------------ .../node/utilities/certsigning/CertificateSigner.kt | 4 ++-- src/main/kotlin/com/r3corda/demos/IRSDemo.kt | 4 ++-- src/main/kotlin/com/r3corda/demos/TraderDemo.kt | 4 ++-- 5 files changed, 8 insertions(+), 21 deletions(-) diff --git a/node/src/main/kotlin/com/r3corda/node/driver/Driver.kt b/node/src/main/kotlin/com/r3corda/node/driver/Driver.kt index 7f41529c3d..4bdc406752 100644 --- a/node/src/main/kotlin/com/r3corda/node/driver/Driver.kt +++ b/node/src/main/kotlin/com/r3corda/node/driver/Driver.kt @@ -9,7 +9,6 @@ import com.r3corda.core.node.services.NetworkMapCache import com.r3corda.core.node.services.ServiceInfo import com.r3corda.node.services.config.FullNodeConfiguration import com.r3corda.node.services.config.NodeConfiguration -import com.r3corda.node.services.config.NodeConfigurationFromConfig import com.r3corda.node.services.messaging.ArtemisMessagingComponent import com.r3corda.node.services.messaging.ArtemisMessagingServer import com.r3corda.node.services.messaging.NodeMessagingClient @@ -327,7 +326,7 @@ class DriverDSL( serverAddress: HostAndPort ): Future { - val nodeConfiguration = NodeConfigurationFromConfig( + val nodeConfiguration = FullNodeConfiguration( NodeConfiguration.loadConfig( baseDirectoryPath = Paths.get(baseDirectory, providedName), allowMissingConfig = true, @@ -356,7 +355,7 @@ class DriverDSL( override fun startLocalServer(): Future { val name = "driver-local-server" - val config = NodeConfigurationFromConfig( + val config = FullNodeConfiguration( NodeConfiguration.loadConfig( baseDirectoryPath = Paths.get(baseDirectory, name), allowMissingConfig = true, diff --git a/node/src/main/kotlin/com/r3corda/node/services/config/NodeConfiguration.kt b/node/src/main/kotlin/com/r3corda/node/services/config/NodeConfiguration.kt index 1c9cee6625..d049bd29ec 100644 --- a/node/src/main/kotlin/com/r3corda/node/services/config/NodeConfiguration.kt +++ b/node/src/main/kotlin/com/r3corda/node/services/config/NodeConfiguration.kt @@ -124,18 +124,6 @@ fun Config.getProperties(path: String): Properties { return props } -class NodeConfigurationFromConfig(val config: Config = ConfigFactory.load()) : NodeConfiguration { - override val basedir: Path by config - override val myLegalName: String by config - override val nearestCity: String by config - override val emailAddress: String by config - override val exportJMXto: String by config - override val keyStorePassword: String by config - override val trustStorePassword: String by config - override val dataSourceProperties: Properties by config - override val devMode: Boolean by config.getOrElse { false } -} - class FullNodeConfiguration(conf: Config) : NodeConfiguration { override val basedir: Path by conf override val myLegalName: String by conf diff --git a/node/src/main/kotlin/com/r3corda/node/utilities/certsigning/CertificateSigner.kt b/node/src/main/kotlin/com/r3corda/node/utilities/certsigning/CertificateSigner.kt index fe31681727..86c9904a07 100644 --- a/node/src/main/kotlin/com/r3corda/node/utilities/certsigning/CertificateSigner.kt +++ b/node/src/main/kotlin/com/r3corda/node/utilities/certsigning/CertificateSigner.kt @@ -9,8 +9,8 @@ import com.r3corda.core.crypto.X509Utilities.addOrReplaceKey import com.r3corda.core.div import com.r3corda.core.minutes import com.r3corda.core.utilities.loggerFor +import com.r3corda.node.services.config.FullNodeConfiguration import com.r3corda.node.services.config.NodeConfiguration -import com.r3corda.node.services.config.NodeConfigurationFromConfig import com.r3corda.node.services.config.getValue import joptsimple.OptionParser import java.net.URL @@ -131,7 +131,7 @@ fun main(args: Array) { val configFile = if (cmdlineOptions.has(ParamsSpec.configFileArg)) Paths.get(cmdlineOptions.valueOf(ParamsSpec.configFileArg)) else null val config = NodeConfiguration.loadConfig(baseDirectoryPath, configFile, allowMissingConfig = true).let { config -> - object : NodeConfiguration by NodeConfigurationFromConfig(config) { + object : NodeConfiguration by FullNodeConfiguration(config) { val certificateSigningService: URL by config } } diff --git a/src/main/kotlin/com/r3corda/demos/IRSDemo.kt b/src/main/kotlin/com/r3corda/demos/IRSDemo.kt index 28640bd66f..2f440fad37 100644 --- a/src/main/kotlin/com/r3corda/demos/IRSDemo.kt +++ b/src/main/kotlin/com/r3corda/demos/IRSDemo.kt @@ -21,8 +21,8 @@ import com.r3corda.demos.utilities.putJson import com.r3corda.demos.utilities.uploadFile import com.r3corda.node.internal.AbstractNode import com.r3corda.node.internal.Node +import com.r3corda.node.services.config.FullNodeConfiguration import com.r3corda.node.services.config.NodeConfiguration -import com.r3corda.node.services.config.NodeConfigurationFromConfig import com.r3corda.node.services.messaging.NodeMessagingClient import com.r3corda.node.services.network.NetworkMapService import com.r3corda.node.services.transactions.SimpleNotaryService @@ -455,7 +455,7 @@ private fun loadConfigFile(baseDir: Path, configFile: Path, defaultLegalName: St createDefaultConfigFile(configFile, defaultLegalName) log.warn("Default config created at $configFile.") } - return NodeConfigurationFromConfig(NodeConfiguration.loadConfig(baseDir, configFileOverride = configFile)) + return FullNodeConfiguration(NodeConfiguration.loadConfig(baseDir, configFileOverride = configFile)) } private fun createIdentities(nodeConf: NodeConfiguration) { diff --git a/src/main/kotlin/com/r3corda/demos/TraderDemo.kt b/src/main/kotlin/com/r3corda/demos/TraderDemo.kt index 4ace3081be..041a312510 100644 --- a/src/main/kotlin/com/r3corda/demos/TraderDemo.kt +++ b/src/main/kotlin/com/r3corda/demos/TraderDemo.kt @@ -23,8 +23,8 @@ import com.r3corda.core.utilities.Emoji import com.r3corda.core.utilities.LogHelper import com.r3corda.core.utilities.ProgressTracker import com.r3corda.node.internal.Node +import com.r3corda.node.services.config.FullNodeConfiguration import com.r3corda.node.services.config.NodeConfiguration -import com.r3corda.node.services.config.NodeConfigurationFromConfig import com.r3corda.node.services.messaging.NodeMessagingClient import com.r3corda.node.services.network.NetworkMapService import com.r3corda.node.services.persistence.NodeAttachmentService @@ -122,7 +122,7 @@ fun main(args: Array) { Role.BUYER -> "Bank A" Role.SELLER -> "Bank B" } - NodeConfigurationFromConfig(NodeConfiguration.loadConfig(directory, allowMissingConfig = true, configOverrides = mapOf("myLegalName" to myLegalName))) + FullNodeConfiguration(NodeConfiguration.loadConfig(directory, allowMissingConfig = true, configOverrides = mapOf("myLegalName" to myLegalName))) } // Which services will this instance of the node provide to the network?