From 1671f7da3101cdc8671ccdae4d0e029e6425bcab Mon Sep 17 00:00:00 2001 From: Michele Sollecito Date: Thu, 8 Nov 2018 17:00:03 +0000 Subject: [PATCH] Working on merging changes to NodeConfigurationImpl. --- .../services/config/NodeConfigurationImpl.kt | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/node/src/main/kotlin/net/corda/node/services/config/NodeConfigurationImpl.kt b/node/src/main/kotlin/net/corda/node/services/config/NodeConfigurationImpl.kt index bbffe3ae18..263062698f 100644 --- a/node/src/main/kotlin/net/corda/node/services/config/NodeConfigurationImpl.kt +++ b/node/src/main/kotlin/net/corda/node/services/config/NodeConfigurationImpl.kt @@ -84,12 +84,6 @@ data class NodeConfigurationImpl( override val cryptoServiceName: SupportedCryptoServices? = Defaults.cryptoServiceName, override val cryptoServiceConf: String? = Defaults.cryptoServiceConf ) : NodeConfiguration { - companion object { - private const val CORDAPPS_DIR_NAME_DEFAULT = "cordapps" - private val logger = loggerFor() - // private val supportedCryptoServiceNames = setOf("BC", "UTIMACO", "GEMALTO-LUNA", "AZURE-KEY-VAULT") - } - internal object Defaults { val jmxMonitoringHttpPort: Int? = null val compatibilityZoneURL: URL? = null @@ -133,6 +127,14 @@ data class NodeConfigurationImpl( fun database(devMode: Boolean) = DatabaseConfig(initialiseSchema = devMode, exportHibernateJMXStatistics = devMode) } + companion object { + private const val CORDAPPS_DIR_NAME_DEFAULT = "cordapps" + + private val logger = loggerFor() + + // private val supportedCryptoServiceNames = setOf("BC", "UTIMACO", "GEMALTO-LUNA", "AZURE-KEY-VAULT") + } + private val actualRpcSettings: NodeRpcSettings init { @@ -157,9 +159,9 @@ data class NodeConfigurationImpl( } // ensure our datasource configuration is sane - require(dataSourceProperties.get("autoCommit") != true) { "Datbase auto commit cannot be enabled, Corda requires transactional behaviour" } - dataSourceProperties.set("autoCommit", false) - if (dataSourceProperties.get("transactionIsolation") == null) { + require(dataSourceProperties["autoCommit"] != true) { "Datbase auto commit cannot be enabled, Corda requires transactional behaviour" } + dataSourceProperties["autoCommit"] = false + if (dataSourceProperties["transactionIsolation"] == null) { dataSourceProperties["transactionIsolation"] = database.transactionIsolationLevel.jdbcString } @@ -214,6 +216,17 @@ data class NodeConfigurationImpl( return actualRpcSettings.asOptions() } + override val transactionCacheSizeBytes: Long + get() = transactionCacheSizeMegaBytes?.MB ?: super.transactionCacheSizeBytes + override val attachmentContentCacheSizeBytes: Long + get() = attachmentContentCacheSizeMegaBytes?.MB ?: super.attachmentContentCacheSizeBytes + + override val effectiveH2Settings: NodeH2Settings? + get() = when { + h2port != null -> NodeH2Settings(address = NetworkHostAndPort(host = "localhost", port = h2port)) + else -> h2Settings + } + fun validate(): List { val errors = mutableListOf() errors += validateDevModeOptions() @@ -298,17 +311,6 @@ data class NodeConfigurationImpl( return errors } - - override val transactionCacheSizeBytes: Long - get() = transactionCacheSizeMegaBytes?.MB ?: super.transactionCacheSizeBytes - override val attachmentContentCacheSizeBytes: Long - get() = attachmentContentCacheSizeMegaBytes?.MB ?: super.attachmentContentCacheSizeBytes - - override val effectiveH2Settings: NodeH2Settings? - get() = when { - h2port != null -> NodeH2Settings(address = NetworkHostAndPort(host = "localhost", port = h2port)) - else -> h2Settings - } } data class NodeRpcSettings(