mirror of
https://github.com/corda/corda.git
synced 2025-01-24 21:37:05 +00:00
[CORDA-461] Remove deprecated APIs. (#1480)
https://r3-cev.atlassian.net/browse/CORDA-461
This commit is contained in:
parent
024285b007
commit
ea61e6e9d5
6
.idea/compiler.xml
generated
6
.idea/compiler.xml
generated
@ -87,6 +87,12 @@
|
||||
<module name="simm-valuation-demo_integrationTest" target="1.8" />
|
||||
<module name="simm-valuation-demo_main" target="1.8" />
|
||||
<module name="simm-valuation-demo_test" target="1.8" />
|
||||
<module name="smoke-test-utils_main" target="1.8" />
|
||||
<module name="smoke-test-utils_test" target="1.8" />
|
||||
<module name="test-common_main" target="1.8" />
|
||||
<module name="test-common_test" target="1.8" />
|
||||
<module name="test-utils_main" target="1.8" />
|
||||
<module name="test-utils_test" target="1.8" />
|
||||
<module name="testing-node-driver_integrationTest" target="1.8" />
|
||||
<module name="testing-node-driver_main" target="1.8" />
|
||||
<module name="testing-node-driver_test" target="1.8" />
|
||||
|
@ -1,13 +1,6 @@
|
||||
package net.corda.core.node
|
||||
|
||||
import net.corda.core.flows.FlowLogic
|
||||
import net.corda.core.identity.Party
|
||||
|
||||
/**
|
||||
* A service hub to be used by the [CordaPluginRegistry]
|
||||
*/
|
||||
interface PluginServiceHub : ServiceHub {
|
||||
@Deprecated("This is no longer used. Instead annotate the flows produced by your factory with @InitiatedBy and have " +
|
||||
"them point to the initiating flow class.", level = DeprecationLevel.ERROR)
|
||||
fun registerFlowInitiator(initiatingFlowClass: Class<out FlowLogic<*>>, serviceFlowFactory: (Party) -> FlowLogic<*>) = Unit
|
||||
}
|
||||
interface PluginServiceHub : ServiceHub
|
||||
|
@ -18,16 +18,6 @@ interface IdentityService {
|
||||
val trustAnchor: TrustAnchor
|
||||
val caCertStore: CertStore
|
||||
|
||||
/**
|
||||
* Verify and then store an identity.
|
||||
*
|
||||
* @param party a party representing a legal entity and the certificate path linking them to the network trust root.
|
||||
* @throws IllegalArgumentException if the certificate path is invalid.
|
||||
*/
|
||||
@Throws(CertificateExpiredException::class, CertificateNotYetValidException::class, InvalidAlgorithmParameterException::class)
|
||||
@Deprecated("Use verifyAndRegisterIdentity() instead, which is the same function with a better name")
|
||||
fun registerIdentity(party: PartyAndCertificate)
|
||||
|
||||
/**
|
||||
* Verify and then store an identity.
|
||||
*
|
||||
|
@ -131,9 +131,6 @@ open class OpaqueBytes(override val bytes: ByteArray) : ByteSequence() {
|
||||
override val offset: Int get() = 0
|
||||
}
|
||||
|
||||
@Deprecated("Use sequence instead")
|
||||
fun ByteArray.opaque(): OpaqueBytes = OpaqueBytes(this)
|
||||
|
||||
fun ByteArray.sequence(offset: Int = 0, size: Int = this.size) = ByteSequence.of(this, offset, size)
|
||||
|
||||
fun ByteArray.toHexString(): String = DatatypeConverter.printHexBinary(this)
|
||||
|
@ -74,18 +74,36 @@ val Int.millis: Duration get() = Duration.ofMillis(toLong())
|
||||
* will not be serialized, and if it's missing (or the first time it's accessed), the initializer will be
|
||||
* used to set it up.
|
||||
*/
|
||||
@Suppress("DEPRECATION")
|
||||
fun <T> transient(initializer: () -> T) = TransientProperty(initializer)
|
||||
fun <T> transient(initializer: () -> T): PropertyDelegate<T> = TransientProperty(initializer)
|
||||
|
||||
/**
|
||||
* Simple interface encapsulating the implicit Kotlin contract for immutable property delegates.
|
||||
*/
|
||||
interface PropertyDelegate<out T> {
|
||||
/**
|
||||
* Invoked as part of Kotlin delegated properties construct.
|
||||
*/
|
||||
operator fun getValue(thisRef: Any?, property: KProperty<*>): T
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple interface encapsulating the implicit Kotlin contract for mutable property delegates.
|
||||
*/
|
||||
interface VariablePropertyDelegate<T> : PropertyDelegate<T> {
|
||||
/**
|
||||
* Invoked as part of Kotlin delegated properties construct.
|
||||
*/
|
||||
operator fun setValue(thisRef: Any?, property: KProperty<*>, value: T)
|
||||
}
|
||||
|
||||
@Deprecated("Use transient")
|
||||
@CordaSerializable
|
||||
class TransientProperty<out T>(private val initialiser: () -> T) {
|
||||
private class TransientProperty<out T> internal constructor(private val initialiser: () -> T) : PropertyDelegate<T> {
|
||||
@Transient private var initialised = false
|
||||
@Transient private var value: T? = null
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Synchronized
|
||||
operator fun getValue(thisRef: Any?, property: KProperty<*>): T {
|
||||
override operator fun getValue(thisRef: Any?, property: KProperty<*>): T {
|
||||
if (!initialised) {
|
||||
value = initialiser()
|
||||
initialised = true
|
||||
|
@ -15,11 +15,7 @@ import java.io.Serializable
|
||||
* - Are any objects *reachable* from this object mismatched or not what you expected?
|
||||
* - Is it suspiciously large or small?
|
||||
*/
|
||||
class UntrustworthyData<out T>(private val fromUntrustedWorld: T) {
|
||||
val data: T
|
||||
@Deprecated("Accessing the untrustworthy data directly without validating it first is a bad idea")
|
||||
get() = fromUntrustedWorld
|
||||
|
||||
class UntrustworthyData<out T>(@PublishedApi internal val fromUntrustedWorld: T) {
|
||||
@Suspendable
|
||||
@Throws(FlowException::class)
|
||||
fun <R> unwrap(validator: Validator<T, R>) = validator.validate(fromUntrustedWorld)
|
||||
@ -32,5 +28,4 @@ class UntrustworthyData<out T>(private val fromUntrustedWorld: T) {
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
inline fun <T, R> UntrustworthyData<T>.unwrap(validator: (T) -> R): R = validator(data)
|
||||
inline fun <T, R> UntrustworthyData<T>.unwrap(validator: (T) -> R): R = validator(fromUntrustedWorld)
|
||||
|
@ -138,6 +138,10 @@ UNRELEASED
|
||||
* Parties were not displayed for created deals in single view.
|
||||
* Non-default notional amounts caused the creation of new deals to fail.
|
||||
|
||||
.. warning:: Renamed configuration property key `basedir` to `baseDirectory`. This will require updating existing configuration files.
|
||||
|
||||
* Removed deprecated parts of the API.
|
||||
|
||||
Milestone 14
|
||||
------------
|
||||
|
||||
|
@ -49,7 +49,7 @@ NetworkMapService plus Simple Notary configuration file.
|
||||
Fields
|
||||
------
|
||||
|
||||
The available config fields are listed below. ``basedir`` is available as a substitution value, containing the absolute
|
||||
The available config fields are listed below. ``baseDirectory`` is available as a substitution value, containing the absolute
|
||||
path to the node's base directory.
|
||||
|
||||
:myLegalName: The legal identity of the node acts as a human readable alias to the node's public key and several demos use
|
||||
|
@ -3,7 +3,7 @@ keyStorePassword : "cordacadevpass"
|
||||
trustStorePassword : "trustpass"
|
||||
dataSourceProperties : {
|
||||
dataSourceClassName : org.h2.jdbcx.JdbcDataSource
|
||||
"dataSource.url" : "jdbc:h2:file:"${basedir}"/persistence"
|
||||
"dataSource.url" : "jdbc:h2:file:"${baseDirectory}"/persistence"
|
||||
"dataSource.user" : sa
|
||||
"dataSource.password" : ""
|
||||
}
|
||||
|
@ -79,31 +79,6 @@ open class ContractBuilder {
|
||||
return c
|
||||
}
|
||||
|
||||
@Deprecated(level = DeprecationLevel.ERROR, message = "Not allowed")
|
||||
fun Action(@Suppress("UNUSED_PARAMETER") name: String, @Suppress("UNUSED_PARAMETER") condition: Perceivable<Boolean>,
|
||||
@Suppress("UNUSED_PARAMETER") actors: Set<Party>, @Suppress("UNUSED_PARAMETER") arrangement: Arrangement) {
|
||||
}
|
||||
|
||||
@Deprecated(level = DeprecationLevel.ERROR, message = "Not available")
|
||||
fun <T> String.anytime(@Suppress("UNUSED_PARAMETER") ignore: T) {
|
||||
}
|
||||
|
||||
@Deprecated(level = DeprecationLevel.ERROR, message = "Not available")
|
||||
fun <T> String.givenThat(@Suppress("UNUSED_PARAMETER") ignore: T) {
|
||||
}
|
||||
|
||||
@Deprecated(level = DeprecationLevel.ERROR, message = "Not available")
|
||||
fun <T> String.givenThat(@Suppress("UNUSED_PARAMETER") ignore1: T, @Suppress("UNUSED_PARAMETER") ignore2: T) {
|
||||
}
|
||||
|
||||
@Deprecated(level = DeprecationLevel.ERROR, message = "Not available")
|
||||
fun Party.may(init: ActionBuilder.() -> Action) {
|
||||
}
|
||||
|
||||
@Deprecated(level = DeprecationLevel.ERROR, message = "Not available")
|
||||
fun Set<Party>.may(init: ActionBuilder.() -> Action) {
|
||||
}
|
||||
|
||||
val start = StartDate()
|
||||
val end = EndDate()
|
||||
|
||||
|
@ -1,53 +0,0 @@
|
||||
package net.corda.finance.flows
|
||||
|
||||
import net.corda.core.contracts.Amount
|
||||
import net.corda.core.identity.Party
|
||||
import net.corda.core.messaging.CordaRPCOps
|
||||
import net.corda.core.messaging.FlowHandle
|
||||
import net.corda.core.messaging.startFlow
|
||||
import net.corda.core.utilities.OpaqueBytes
|
||||
import net.corda.core.utilities.getOrThrow
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* A command to initiate the cash flow with.
|
||||
*/
|
||||
@Deprecated("Please use the flows directly, these will be removed in a later release")
|
||||
sealed class CashFlowCommand {
|
||||
abstract fun startFlow(proxy: CordaRPCOps): FlowHandle<AbstractCashFlow.Result>
|
||||
|
||||
/**
|
||||
* A command to initiate the Cash flow with.
|
||||
*/
|
||||
data class IssueCash(val amount: Amount<Currency>,
|
||||
val issueRef: OpaqueBytes,
|
||||
val recipient: Party,
|
||||
val notary: Party,
|
||||
val anonymous: Boolean) : CashFlowCommand() {
|
||||
override fun startFlow(proxy: CordaRPCOps): FlowHandle<AbstractCashFlow.Result> {
|
||||
proxy.startFlow(::CashIssueFlow, amount, issueRef, notary).returnValue.getOrThrow()
|
||||
return proxy.startFlow(::CashPaymentFlow, amount, recipient, anonymous)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pay cash to someone else.
|
||||
*
|
||||
* @param amount the amount of currency to issue on to the ledger.
|
||||
* @param recipient the party to issue the cash to.
|
||||
*/
|
||||
data class PayCash(val amount: Amount<Currency>, val recipient: Party, val issuerConstraint: Party? = null,
|
||||
val anonymous: Boolean) : CashFlowCommand() {
|
||||
override fun startFlow(proxy: CordaRPCOps) = proxy.startFlow(::CashPaymentFlow, amount, recipient, anonymous)
|
||||
}
|
||||
|
||||
/**
|
||||
* Exit cash from the ledger.
|
||||
*
|
||||
* @param amount the amount of currency to exit from the ledger.
|
||||
* @param issueRef the reference previously specified on the issuance.
|
||||
*/
|
||||
data class ExitCash(val amount: Amount<Currency>, val issueRef: OpaqueBytes) : CashFlowCommand() {
|
||||
override fun startFlow(proxy: CordaRPCOps) = proxy.startFlow(::CashExitFlow, amount, issueRef)
|
||||
}
|
||||
}
|
@ -35,7 +35,7 @@ object ConfigHelper {
|
||||
val appConfig = ConfigFactory.parseFile(configFile.toFile(), parseOptions.setAllowMissing(allowMissingConfig))
|
||||
val finalConfig = configOf(
|
||||
// Add substitution values here
|
||||
"basedir" to baseDirectory.toString())
|
||||
"baseDirectory" to baseDirectory.toString())
|
||||
.withFallback(configOverrides)
|
||||
.withFallback(appConfig)
|
||||
.withFallback(defaultConfig)
|
||||
|
@ -40,11 +40,8 @@ interface NodeConfiguration : NodeSSLConfiguration {
|
||||
}
|
||||
|
||||
data class FullNodeConfiguration(
|
||||
// TODO Remove this subsitution value and use baseDirectory as the subsitution instead
|
||||
@Deprecated(
|
||||
"This is a substitution value which points to the baseDirectory and is manually added into the config before parsing",
|
||||
ReplaceWith("baseDirectory"))
|
||||
val basedir: Path,
|
||||
/** This is not retrieved from the config file but rather from a command line argument. */
|
||||
override val baseDirectory: Path,
|
||||
override val myLegalName: CordaX500Name,
|
||||
override val emailAddress: String,
|
||||
override val keyStorePassword: String,
|
||||
@ -73,9 +70,6 @@ data class FullNodeConfiguration(
|
||||
val useTestClock: Boolean = false,
|
||||
val detectPublicIp: Boolean = true
|
||||
) : NodeConfiguration {
|
||||
/** This is not retrieved from the config file but rather from a command line argument. */
|
||||
@Suppress("DEPRECATION")
|
||||
override val baseDirectory: Path get() = basedir
|
||||
override val exportJMXto: String get() = "http"
|
||||
|
||||
init {
|
||||
|
@ -54,10 +54,6 @@ class InMemoryIdentityService(identities: Iterable<PartyAndCertificate> = emptyS
|
||||
}
|
||||
}
|
||||
|
||||
override fun registerIdentity(party: PartyAndCertificate) {
|
||||
verifyAndRegisterIdentity(party)
|
||||
}
|
||||
|
||||
// TODO: Check the certificate validation logic
|
||||
@Throws(CertificateExpiredException::class, CertificateNotYetValidException::class, InvalidAlgorithmParameterException::class)
|
||||
override fun verifyAndRegisterIdentity(identity: PartyAndCertificate): PartyAndCertificate? {
|
||||
|
@ -110,10 +110,6 @@ class PersistentIdentityService(identities: Iterable<PartyAndCertificate> = empt
|
||||
}
|
||||
}
|
||||
|
||||
override fun registerIdentity(party: PartyAndCertificate) {
|
||||
verifyAndRegisterIdentity(party)
|
||||
}
|
||||
|
||||
// TODO: Check the certificate validation logic
|
||||
@Throws(CertificateExpiredException::class, CertificateNotYetValidException::class, InvalidAlgorithmParameterException::class)
|
||||
override fun verifyAndRegisterIdentity(identity: PartyAndCertificate): PartyAndCertificate? {
|
||||
|
@ -5,7 +5,7 @@ keyStorePassword = "cordacadevpass"
|
||||
trustStorePassword = "trustpass"
|
||||
dataSourceProperties = {
|
||||
dataSourceClassName = org.h2.jdbcx.JdbcDataSource
|
||||
"dataSource.url" = "jdbc:h2:file:"${basedir}"/persistence;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=10000;WRITE_DELAY=100;AUTO_SERVER_PORT="${h2port}
|
||||
"dataSource.url" = "jdbc:h2:file:"${baseDirectory}"/persistence;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=10000;WRITE_DELAY=100;AUTO_SERVER_PORT="${h2port}
|
||||
"dataSource.user" = sa
|
||||
"dataSource.password" = ""
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ class FullNodeConfigurationTest {
|
||||
@Test
|
||||
fun `Artemis special characters not permitted in RPC usernames`() {
|
||||
val testConfiguration = FullNodeConfiguration(
|
||||
basedir = Paths.get("."),
|
||||
baseDirectory = Paths.get("."),
|
||||
myLegalName = ALICE.name,
|
||||
networkMapService = null,
|
||||
emailAddress = "",
|
||||
|
@ -41,38 +41,6 @@ import kotlin.collections.set
|
||||
// }
|
||||
//
|
||||
|
||||
/**
|
||||
* Here follows implementations of the [LedgerDSLInterpreter] and [TransactionDSLInterpreter] interfaces to be used in
|
||||
* tests. Top level primitives [ledger] and [transaction] that bind the interpreter types are also defined here.
|
||||
*/
|
||||
|
||||
@Deprecated(
|
||||
message = "ledger doesn't nest, use tweak",
|
||||
replaceWith = ReplaceWith("tweak"),
|
||||
level = DeprecationLevel.ERROR)
|
||||
@Suppress("UNUSED_PARAMETER", "unused")
|
||||
fun TransactionDSLInterpreter.ledger(
|
||||
dsl: LedgerDSL<TestTransactionDSLInterpreter, TestLedgerDSLInterpreter>.() -> Unit) {
|
||||
}
|
||||
|
||||
@Deprecated(
|
||||
message = "transaction doesn't nest, use tweak",
|
||||
replaceWith = ReplaceWith("tweak"),
|
||||
level = DeprecationLevel.ERROR)
|
||||
@Suppress("UNUSED_PARAMETER", "unused")
|
||||
fun TransactionDSLInterpreter.transaction(
|
||||
dsl: TransactionDSL<TransactionDSLInterpreter>.() -> EnforceVerifyOrFail) {
|
||||
}
|
||||
|
||||
@Deprecated(
|
||||
message = "ledger doesn't nest, use tweak",
|
||||
replaceWith = ReplaceWith("tweak"),
|
||||
level = DeprecationLevel.ERROR)
|
||||
@Suppress("UNUSED_PARAMETER", "unused")
|
||||
fun LedgerDSLInterpreter<TransactionDSLInterpreter>.ledger(
|
||||
dsl: LedgerDSL<TestTransactionDSLInterpreter, TestLedgerDSLInterpreter>.() -> Unit) {
|
||||
}
|
||||
|
||||
/**
|
||||
* If you jumped here from a compiler error make sure the last line of your test tests for a transaction verify or fail.
|
||||
* This is a dummy type that can only be instantiated by functions in this module. This way we can ensure that all tests
|
||||
|
@ -199,7 +199,7 @@ class NodeConfigTest {
|
||||
config.networkMap = NetworkMapConfig(DUMMY_NOTARY.name, 12345)
|
||||
|
||||
val nodeConfig = config.toFileConfig()
|
||||
.withValue("basedir", ConfigValueFactory.fromAnyRef(baseDir.toString()))
|
||||
.withValue("baseDirectory", ConfigValueFactory.fromAnyRef(baseDir.toString()))
|
||||
.withFallback(ConfigFactory.parseResources("reference.conf"))
|
||||
.resolve()
|
||||
val fullConfig = nodeConfig.parseAs<FullNodeConfiguration>()
|
||||
@ -229,7 +229,7 @@ class NodeConfigTest {
|
||||
config.networkMap = NetworkMapConfig(DUMMY_NOTARY.name, 12345)
|
||||
|
||||
val nodeConfig = config.toFileConfig()
|
||||
.withValue("basedir", ConfigValueFactory.fromAnyRef(baseDir.toString()))
|
||||
.withValue("baseDirectory", ConfigValueFactory.fromAnyRef(baseDir.toString()))
|
||||
.withFallback(ConfigFactory.parseResources("web-reference.conf"))
|
||||
.resolve()
|
||||
val webConfig = WebServerConfig(baseDir, nodeConfig)
|
||||
|
@ -69,7 +69,7 @@ data class CmdLineOptions(val baseDirectory: Path,
|
||||
val appConfig = ConfigFactory.parseFile(configFile.toFile(), parseOptions.setAllowMissing(allowMissingConfig))
|
||||
val overrideConfig = ConfigFactory.parseMap(configOverrides + mapOf(
|
||||
// Add substitution values here
|
||||
"basedir" to baseDirectory.toString())
|
||||
"baseDirectory" to baseDirectory.toString())
|
||||
)
|
||||
val finalConfig = overrideConfig
|
||||
.withFallback(appConfig)
|
||||
|
Loading…
Reference in New Issue
Block a user