Change public constant values to Kotlin constants (#1588)

* Make string constants into Kotlin constants

* Add JvmName annotation to KeyStoreUtilities
This commit is contained in:
Ross Nicoll 2017-09-21 15:32:02 +01:00 committed by josecoll
parent c108637df6
commit c05e482c8f
10 changed files with 26 additions and 24 deletions

View File

@ -30,7 +30,7 @@ import java.util.*
@CordaSerializable
class CompositeKey private constructor(val threshold: Int, children: List<NodeAndWeight>) : PublicKey {
companion object {
val KEY_ALGORITHM = "COMPOSITE"
const val KEY_ALGORITHM = "COMPOSITE"
/**
* Build a composite key from a DER encoded form.
*/

View File

@ -10,7 +10,7 @@ import net.corda.finance.contracts.FixOf
import java.math.BigDecimal
import java.time.Instant
val UNIVERSAL_PROGRAM_ID = "net.corda.finance.contracts.universal.UniversalContract"
const val UNIVERSAL_PROGRAM_ID = "net.corda.finance.contracts.universal.UniversalContract"
class UniversalContract : Contract {
data class State(override val participants: List<AbstractParty>,

View File

@ -25,7 +25,7 @@ import kotlin.concurrent.withLock
class CashSelectionH2Impl : CashSelection {
companion object {
val JDBC_DRIVER_NAME = "H2 JDBC Driver"
const val JDBC_DRIVER_NAME = "H2 JDBC Driver"
val log = loggerFor<CashSelectionH2Impl>()
}

View File

@ -14,7 +14,7 @@ import java.util.*
class CashSelectionMySQLImpl : CashSelection {
companion object {
val JDBC_DRIVER_NAME = "MySQL JDBC Driver"
const val JDBC_DRIVER_NAME = "MySQL JDBC Driver"
}
override fun isCompatible(metadata: DatabaseMetaData): Boolean {

View File

@ -8,11 +8,11 @@ import org.apache.activemq.artemis.api.core.client.ClientMessage
import org.apache.activemq.artemis.reader.MessageUtil
object VerifierApi {
val VERIFIER_USERNAME = "SystemUsers/Verifier"
val VERIFICATION_REQUESTS_QUEUE_NAME = "verifier.requests"
val VERIFICATION_RESPONSES_QUEUE_NAME_PREFIX = "verifier.responses"
private val VERIFICATION_ID_FIELD_NAME = "id"
private val RESULT_EXCEPTION_FIELD_NAME = "result-exception"
const val VERIFIER_USERNAME = "SystemUsers/Verifier"
const val VERIFICATION_REQUESTS_QUEUE_NAME = "verifier.requests"
const val VERIFICATION_RESPONSES_QUEUE_NAME_PREFIX = "verifier.responses"
private const val VERIFICATION_ID_FIELD_NAME = "id"
private const val RESULT_EXCEPTION_FIELD_NAME = "result-exception"
data class VerificationRequest(
val verificationId: Long,

View File

@ -18,9 +18,9 @@ import net.corda.nodeapi.internal.serialization.carpenter.Field as CarpenterFiel
import net.corda.nodeapi.internal.serialization.carpenter.Schema as CarpenterSchema
// TODO: get an assigned number as per AMQP spec
val DESCRIPTOR_TOP_32BITS: Long = 0xc0da0000
const val DESCRIPTOR_TOP_32BITS: Long = 0xc0da0000
val DESCRIPTOR_DOMAIN: String = "net.corda"
const val DESCRIPTOR_DOMAIN: String = "net.corda"
// "corda" + majorVersionByte + minorVersionMSB + minorVersionLSB
val AmqpHeaderV1_0: OpaqueBytes = OpaqueBytes("corda\u0001\u0000\u0000".toByteArray())

View File

@ -62,15 +62,15 @@ interface NetworkMapService {
companion object {
val DEFAULT_EXPIRATION_PERIOD: Period = Period.ofWeeks(4)
val FETCH_TOPIC = "platform.network_map.fetch"
val QUERY_TOPIC = "platform.network_map.query"
val REGISTER_TOPIC = "platform.network_map.register"
val SUBSCRIPTION_TOPIC = "platform.network_map.subscribe"
const val FETCH_TOPIC = "platform.network_map.fetch"
const val QUERY_TOPIC = "platform.network_map.query"
const val REGISTER_TOPIC = "platform.network_map.register"
const val SUBSCRIPTION_TOPIC = "platform.network_map.subscribe"
// Base topic used when pushing out updates to the network map. Consumed, for example, by the map cache.
// When subscribing to these updates, remember they must be acknowledged
val PUSH_TOPIC = "platform.network_map.push"
const val PUSH_TOPIC = "platform.network_map.push"
// Base topic for messages acknowledging pushed updates
val PUSH_ACK_TOPIC = "platform.network_map.push_ack"
const val PUSH_ACK_TOPIC = "platform.network_map.push_ack"
val type = ServiceType.networkMap
}

View File

@ -1,3 +1,5 @@
@file:JvmName("KeyStoreUtilities")
package net.corda.node.utilities
import net.corda.core.crypto.Crypto
@ -14,7 +16,7 @@ import java.security.cert.Certificate
import java.security.cert.CertificateFactory
import java.security.cert.X509Certificate
val KEYSTORE_TYPE = "JKS"
const val KEYSTORE_TYPE = "JKS"
/**
* Helper method to either open an existing keystore for modification, or create a new blank keystore.

View File

@ -44,12 +44,12 @@ object X509Utilities {
val DEFAULT_TLS_SIGNATURE_SCHEME = Crypto.ECDSA_SECP256R1_SHA256
// Aliases for private keys and certificates.
val CORDA_ROOT_CA = "cordarootca"
val CORDA_INTERMEDIATE_CA = "cordaintermediateca"
val CORDA_CLIENT_TLS = "cordaclienttls"
val CORDA_CLIENT_CA = "cordaclientca"
const val CORDA_ROOT_CA = "cordarootca"
const val CORDA_INTERMEDIATE_CA = "cordaintermediateca"
const val CORDA_CLIENT_TLS = "cordaclienttls"
const val CORDA_CLIENT_CA = "cordaclientca"
val CORDA_CLIENT_CA_CN = "Corda Client CA Certificate"
const val CORDA_CLIENT_CA_CN = "Corda Client CA Certificate"
private val DEFAULT_VALIDITY_WINDOW = Pair(0.millis, 3650.days)
/**

View File

@ -50,7 +50,7 @@ class InMemoryMessagingNetwork(
private val messagesInFlight: ReusableLatch = ReusableLatch()
) : SingletonSerializeAsToken() {
companion object {
val MESSAGES_LOG_NAME = "messages"
const val MESSAGES_LOG_NAME = "messages"
private val log = LoggerFactory.getLogger(MESSAGES_LOG_NAME)
}