diff --git a/data/config-schema/src/main/java/net/corda/schema/configuration/BootConfig.java b/data/config-schema/src/main/java/net/corda/schema/configuration/BootConfig.java index da3d210c13..ac957ee3e8 100644 --- a/data/config-schema/src/main/java/net/corda/schema/configuration/BootConfig.java +++ b/data/config-schema/src/main/java/net/corda/schema/configuration/BootConfig.java @@ -36,7 +36,7 @@ private BootConfig() { public static final String BOOT_SECRETS = "secrets"; - public static final String BOOT_STATE_MANAGER = "stateManager"; + public static final String BOOT_STATE_MANAGER = StateManagerConfig.STATE_MANAGER; public static final String BOOT_STATE_MANAGER_TYPE = BOOT_STATE_MANAGER + ".type"; public static final String BOOT_STATE_MANAGER_DB_USER = BOOT_STATE_MANAGER + ".database.user"; public static final String BOOT_STATE_MANAGER_DB_PASS = BOOT_STATE_MANAGER + ".database.pass"; diff --git a/data/config-schema/src/main/java/net/corda/schema/configuration/ConfigKeys.java b/data/config-schema/src/main/java/net/corda/schema/configuration/ConfigKeys.java index 7b7ec6b18a..a18dfda1b1 100644 --- a/data/config-schema/src/main/java/net/corda/schema/configuration/ConfigKeys.java +++ b/data/config-schema/src/main/java/net/corda/schema/configuration/ConfigKeys.java @@ -14,6 +14,7 @@ private ConfigKeys() { public static final String FLOW_CONFIG = "corda.flow"; public static final String MESSAGING_CONFIG = "corda.messaging"; public static final String EXTERNAL_MESSAGING_CONFIG = "corda.externalMessaging"; + public static final String STATE_MANAGER_CONFIG = "corda." + StateManagerConfig.STATE_MANAGER; public static final String UTXO_LEDGER_CONFIG = "corda.ledger.utxo"; public static final String P2P_LINK_MANAGER_CONFIG = "corda.p2p.linkManager"; public static final String P2P_GATEWAY_CONFIG = "corda.p2p.gateway"; diff --git a/data/config-schema/src/main/java/net/corda/schema/configuration/MessagingConfig.java b/data/config-schema/src/main/java/net/corda/schema/configuration/MessagingConfig.java index 0ab038f7f6..ff08267671 100644 --- a/data/config-schema/src/main/java/net/corda/schema/configuration/MessagingConfig.java +++ b/data/config-schema/src/main/java/net/corda/schema/configuration/MessagingConfig.java @@ -78,31 +78,4 @@ private Publisher() { * producers to stay under this limit when publishing messages. */ public static final String MAX_ALLOWED_MSG_SIZE = "maxAllowedMessageSize"; - - /** - * State Manager Configuration for connecting to the underlying persistent storage. - */ - public static final class StateManager { - private StateManager() { - } - - public static final String STATE_MANAGER = "stateManager"; - public static final String TYPE = STATE_MANAGER + ".type"; - - // Database Values - public static final String DB_PROPERTIES = STATE_MANAGER + ".database"; - public static final String JDBC_USER = DB_PROPERTIES + ".user"; - public static final String JDBC_PASS = DB_PROPERTIES + ".pass"; - - public static final String JDBC_URL = DB_PROPERTIES + ".jdbc.url"; - public static final String JDBC_DRIVER = DB_PROPERTIES + ".jdbc.driver"; - public static final String JDBC_DRIVER_DIRECTORY = DB_PROPERTIES + ".jdbc.directory"; - public static final String JDBC_PERSISTENCE_UNIT_NAME = DB_PROPERTIES + ".jdbc.persistenceUnitName"; - public static final String JDBC_POOL_MAX_SIZE = DB_PROPERTIES + ".pool.maxSize"; - public static final String JDBC_POOL_MIN_SIZE = DB_PROPERTIES + ".pool.minSize"; - public static final String JDBC_POOL_IDLE_TIMEOUT_SECONDS = DB_PROPERTIES + ".pool.idleTimeoutSeconds"; - public static final String JDBC_POOL_MAX_LIFETIME_SECONDS = DB_PROPERTIES + ".pool.maxLifetimeSeconds"; - public static final String JDBC_POOL_KEEP_ALIVE_TIME_SECONDS = DB_PROPERTIES + ".pool.keepAliveTimeSeconds"; - public static final String JDBC_POOL_VALIDATION_TIMEOUT_SECONDS = DB_PROPERTIES + ".pool.validationTimeoutSeconds"; - } } diff --git a/data/config-schema/src/main/java/net/corda/schema/configuration/StateManagerConfig.java b/data/config-schema/src/main/java/net/corda/schema/configuration/StateManagerConfig.java new file mode 100644 index 0000000000..c09fc6336d --- /dev/null +++ b/data/config-schema/src/main/java/net/corda/schema/configuration/StateManagerConfig.java @@ -0,0 +1,30 @@ +package net.corda.schema.configuration; + +/** + * Configuration keys to access public parts of the configuration under the {@code corda.stateManager} key. + */ +public final class StateManagerConfig { + private StateManagerConfig() { + } + + public static final String STATE_MANAGER = "stateManager"; + + public static final String TYPE = "type"; + + // Database Configuration Values + public static final class Database { + public static final String DB_PROPERTIES = "database"; + public static final String JDBC_USER = DB_PROPERTIES + ".user"; + public static final String JDBC_PASS = DB_PROPERTIES + ".pass"; + + public static final String JDBC_URL = DB_PROPERTIES + ".jdbc.url"; + public static final String JDBC_DRIVER = DB_PROPERTIES + ".jdbc.driver"; + public static final String JDBC_DRIVER_DIRECTORY = DB_PROPERTIES + ".jdbc.directory"; + public static final String JDBC_POOL_MAX_SIZE = DB_PROPERTIES + ".pool.maxSize"; + public static final String JDBC_POOL_MIN_SIZE = DB_PROPERTIES + ".pool.minSize"; + public static final String JDBC_POOL_IDLE_TIMEOUT_SECONDS = DB_PROPERTIES + ".pool.idleTimeoutSeconds"; + public static final String JDBC_POOL_MAX_LIFETIME_SECONDS = DB_PROPERTIES + ".pool.maxLifetimeSeconds"; + public static final String JDBC_POOL_KEEP_ALIVE_TIME_SECONDS = DB_PROPERTIES + ".pool.keepAliveTimeSeconds"; + public static final String JDBC_POOL_VALIDATION_TIMEOUT_SECONDS = DB_PROPERTIES + ".pool.validationTimeoutSeconds"; + } +} diff --git a/data/config-schema/src/main/resources/net/corda/schema/configuration/messaging/1.0/corda.messaging.json b/data/config-schema/src/main/resources/net/corda/schema/configuration/messaging/1.0/corda.messaging.json index 3b3ebaa4d3..57eaf5e018 100644 --- a/data/config-schema/src/main/resources/net/corda/schema/configuration/messaging/1.0/corda.messaging.json +++ b/data/config-schema/src/main/resources/net/corda/schema/configuration/messaging/1.0/corda.messaging.json @@ -109,37 +109,6 @@ "default": 972800, "minimum": 512000, "maximum": 8388608 - }, - "stateManager": { - "description": "Connection details for the underlying persistent storage used by the out of process State Manager.", - "type": "object", - "properties": { - "type": { - "description": "The type of state manager implementation.", - "enum": [ - "DATABASE" - ] - }, - "additionalProperties": false - }, - "$comment": "Polymorphic state manager storage connection configuration. The valid section depends on which state manager implementation is in use.", - "allOf": [ - { - "if": { - "properties": { "type": { "const": "DATABASE" } }, - "required": ["type"] - }, - "then": { - "properties": { - "databaseProperties": { - "description": "Settings to connect to the state manager database.", - "$ref": "state-manager-db-properties.json" - } - }, - "required": ["type","databaseProperties"] - } - } - ] } }, "additionalProperties": false diff --git a/data/config-schema/src/main/resources/net/corda/schema/configuration/stateManager/1.0/corda.stateManager.json b/data/config-schema/src/main/resources/net/corda/schema/configuration/stateManager/1.0/corda.stateManager.json new file mode 100644 index 0000000000..ecca652728 --- /dev/null +++ b/data/config-schema/src/main/resources/net/corda/schema/configuration/stateManager/1.0/corda.stateManager.json @@ -0,0 +1,44 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://corda.r3.com/net/corda/schema/configuration/stateManager/1.0/corda.stateManager.json", + "title": "Corda State Manager Configuration Schema", + "description": "Configuration schema for the State Manager section. This configures the interactions of the workers with the underlying persistent storage used by the out of process State Manager.", + "type": "object", + "properties": { + "type": { + "description": "The type of state manager implementation.", + "enum": [ + "DATABASE" + ] + }, + "additionalProperties": false + }, + "$comment": "Polymorphic state manager storage connection configuration. The valid section depends on which state manager implementation is in use.", + "allOf": [ + { + "if": { + "properties": { + "type": { + "const": "DATABASE" + } + }, + "required": [ + "type" + ] + }, + "then": { + "properties": { + "databaseProperties": { + "description": "Settings to connect to the State Manager Database.", + "$ref": "stateManager-db-properties.json" + } + }, + "required": [ + "type", + "databaseProperties" + ] + } + } + ], + "additionalProperties": false +} diff --git a/data/config-schema/src/main/resources/net/corda/schema/configuration/messaging/1.0/state-manager-db-properties.json b/data/config-schema/src/main/resources/net/corda/schema/configuration/stateManager/1.0/stateManager-db-properties.json similarity index 93% rename from data/config-schema/src/main/resources/net/corda/schema/configuration/messaging/1.0/state-manager-db-properties.json rename to data/config-schema/src/main/resources/net/corda/schema/configuration/stateManager/1.0/stateManager-db-properties.json index fdba9a5407..f0a89d0738 100644 --- a/data/config-schema/src/main/resources/net/corda/schema/configuration/messaging/1.0/state-manager-db-properties.json +++ b/data/config-schema/src/main/resources/net/corda/schema/configuration/stateManager/1.0/stateManager-db-properties.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2019-09/schema", - "$id": "https://corda.r3.com/net/corda/schema/configuration/db/1.0/corda.db.json", + "$id": "https://corda.r3.com/net/corda/schema/configuration/stateManager/1.0/stateManager-db-properties.json", "title": "State Manager Database Configuration Schema", "description": "Configuration schema for the database section. Note that this configuration cannot be updated dynamically through the REST endpoint.", "type": "object", @@ -23,6 +23,11 @@ "type": "object", "default": {}, "properties": { + "url": { + "description": "The JDBC URL.", + "type": "string", + "default": "jdbc:postgresql://state-manager-db:5432/state_manager" + }, "driver": { "description": "The JDBC driver.", "type": "string", @@ -32,16 +37,6 @@ "description": "The directory that contains the JDBC drivers.", "type": "string", "default": "/opt/jdbc-driver" - }, - "url": { - "description": "The JDBC URL.", - "type": "string", - "default": "jdbc:postgresql://state-manager-db:5432/state_manager" - }, - "persistenceUnitName": { - "description": "The persistent unit name.", - "type": "string", - "default": "corda-state-manager" } }, "additionalProperties": false diff --git a/data/config-schema/src/test/kotlin/net/corda/schema/configuration/provider/impl/SchemaProviderConfigImplTest.kt b/data/config-schema/src/test/kotlin/net/corda/schema/configuration/provider/impl/SchemaProviderConfigImplTest.kt index eedb5e0d56..ec693d023c 100644 --- a/data/config-schema/src/test/kotlin/net/corda/schema/configuration/provider/impl/SchemaProviderConfigImplTest.kt +++ b/data/config-schema/src/test/kotlin/net/corda/schema/configuration/provider/impl/SchemaProviderConfigImplTest.kt @@ -12,6 +12,7 @@ import net.corda.schema.configuration.ConfigKeys.RECONCILIATION_CONFIG import net.corda.schema.configuration.ConfigKeys.REST_CONFIG import net.corda.schema.configuration.ConfigKeys.SANDBOX_CONFIG import net.corda.schema.configuration.ConfigKeys.SECRETS_CONFIG +import net.corda.schema.configuration.ConfigKeys.STATE_MANAGER_CONFIG import net.corda.schema.configuration.ConfigKeys.UTXO_LEDGER_CONFIG import net.corda.schema.configuration.provider.ConfigSchemaException import net.corda.v5.base.versioning.Version @@ -42,6 +43,7 @@ class SchemaProviderConfigImplTest { SANDBOX_CONFIG, RECONCILIATION_CONFIG, MEMBERSHIP_CONFIG, + STATE_MANAGER_CONFIG ) private val VERSIONS = listOf("1.0") @@ -99,4 +101,4 @@ class SchemaProviderConfigImplTest { provider.getSchemaFile(BAD_SCHEMA_FILE) } } -} \ No newline at end of file +} diff --git a/gradle.properties b/gradle.properties index 9553f8d66b..9dbf75b334 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ cordaProductVersion = 5.1.0 # NOTE: update this each time this module contains a breaking change ## NOTE: currently this is a top level revision, so all API versions will line up, but this could be moved to ## a per module property in which case module versions can change independently. -cordaApiRevision = 30 +cordaApiRevision = 31 # Main kotlinVersion = 1.8.21