Remove NodeConfigurationFromConfig and replace usages with FullNodeConfiguration

This commit is contained in:
Andrius Dagys 2016-10-05 10:50:00 +01:00
parent 9707ce7367
commit fac12b4fce
5 changed files with 8 additions and 21 deletions
node/src/main/kotlin/com/r3corda/node
driver
services/config
utilities/certsigning
src/main/kotlin/com/r3corda/demos

View File

@ -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<NodeMessagingClient> {
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<ArtemisMessagingServer> {
val name = "driver-local-server"
val config = NodeConfigurationFromConfig(
val config = FullNodeConfiguration(
NodeConfiguration.loadConfig(
baseDirectoryPath = Paths.get(baseDirectory, name),
allowMissingConfig = true,

View File

@ -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

View File

@ -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<String>) {
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
}
}

View File

@ -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) {

View File

@ -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<String>) {
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?