mirror of
https://github.com/corda/corda.git
synced 2024-12-28 16:58:55 +00:00
Merge pull request #630 from corda/kat-merge-28-03-18
Kat merge 28/03/18
This commit is contained in:
commit
1baa89e9cb
@ -2855,27 +2855,27 @@ public final class net.corda.core.schemas.CommonSchemaV1 extends net.corda.core.
|
|||||||
@javax.persistence.MappedSuperclass @net.corda.core.serialization.CordaSerializable public static class net.corda.core.schemas.CommonSchemaV1$FungibleState extends net.corda.core.schemas.PersistentState
|
@javax.persistence.MappedSuperclass @net.corda.core.serialization.CordaSerializable public static class net.corda.core.schemas.CommonSchemaV1$FungibleState extends net.corda.core.schemas.PersistentState
|
||||||
public <init>()
|
public <init>()
|
||||||
public <init>(Set, net.corda.core.identity.AbstractParty, long, net.corda.core.identity.AbstractParty, byte[])
|
public <init>(Set, net.corda.core.identity.AbstractParty, long, net.corda.core.identity.AbstractParty, byte[])
|
||||||
@org.jetbrains.annotations.NotNull public final net.corda.core.identity.AbstractParty getIssuer()
|
@org.jetbrains.annotations.NotNull public net.corda.core.identity.AbstractParty getIssuer()
|
||||||
@org.jetbrains.annotations.NotNull public final byte[] getIssuerRef()
|
@org.jetbrains.annotations.NotNull public byte[] getIssuerRef()
|
||||||
@org.jetbrains.annotations.NotNull public final net.corda.core.identity.AbstractParty getOwner()
|
@org.jetbrains.annotations.NotNull public net.corda.core.identity.AbstractParty getOwner()
|
||||||
@org.jetbrains.annotations.Nullable public Set getParticipants()
|
@org.jetbrains.annotations.Nullable public Set getParticipants()
|
||||||
public final long getQuantity()
|
public long getQuantity()
|
||||||
public final void setIssuer(net.corda.core.identity.AbstractParty)
|
public void setIssuer(net.corda.core.identity.AbstractParty)
|
||||||
public final void setIssuerRef(byte[])
|
public void setIssuerRef(byte[])
|
||||||
public final void setOwner(net.corda.core.identity.AbstractParty)
|
public void setOwner(net.corda.core.identity.AbstractParty)
|
||||||
public void setParticipants(Set)
|
public void setParticipants(Set)
|
||||||
public final void setQuantity(long)
|
public void setQuantity(long)
|
||||||
##
|
##
|
||||||
@javax.persistence.MappedSuperclass @net.corda.core.serialization.CordaSerializable public static class net.corda.core.schemas.CommonSchemaV1$LinearState extends net.corda.core.schemas.PersistentState
|
@javax.persistence.MappedSuperclass @net.corda.core.serialization.CordaSerializable public static class net.corda.core.schemas.CommonSchemaV1$LinearState extends net.corda.core.schemas.PersistentState
|
||||||
public <init>()
|
public <init>()
|
||||||
public <init>(Set, String, UUID)
|
public <init>(Set, String, UUID)
|
||||||
public <init>(net.corda.core.contracts.UniqueIdentifier, Set)
|
public <init>(net.corda.core.contracts.UniqueIdentifier, Set)
|
||||||
@org.jetbrains.annotations.Nullable public final String getExternalId()
|
@org.jetbrains.annotations.Nullable public String getExternalId()
|
||||||
@org.jetbrains.annotations.Nullable public Set getParticipants()
|
@org.jetbrains.annotations.Nullable public Set getParticipants()
|
||||||
@org.jetbrains.annotations.NotNull public final UUID getUuid()
|
@org.jetbrains.annotations.NotNull public UUID getUuid()
|
||||||
public final void setExternalId(String)
|
public void setExternalId(String)
|
||||||
public void setParticipants(Set)
|
public void setParticipants(Set)
|
||||||
public final void setUuid(UUID)
|
public void setUuid(UUID)
|
||||||
##
|
##
|
||||||
public class net.corda.core.schemas.MappedSchema extends java.lang.Object
|
public class net.corda.core.schemas.MappedSchema extends java.lang.Object
|
||||||
public <init>(Class, int, Iterable)
|
public <init>(Class, int, Iterable)
|
||||||
@ -2888,10 +2888,10 @@ public class net.corda.core.schemas.MappedSchema extends java.lang.Object
|
|||||||
@javax.persistence.MappedSuperclass @net.corda.core.serialization.CordaSerializable public class net.corda.core.schemas.PersistentState extends java.lang.Object implements net.corda.core.schemas.StatePersistable
|
@javax.persistence.MappedSuperclass @net.corda.core.serialization.CordaSerializable public class net.corda.core.schemas.PersistentState extends java.lang.Object implements net.corda.core.schemas.StatePersistable
|
||||||
public <init>()
|
public <init>()
|
||||||
public <init>(net.corda.core.schemas.PersistentStateRef)
|
public <init>(net.corda.core.schemas.PersistentStateRef)
|
||||||
@org.jetbrains.annotations.Nullable public final net.corda.core.schemas.PersistentStateRef getStateRef()
|
@org.jetbrains.annotations.Nullable public net.corda.core.schemas.PersistentStateRef getStateRef()
|
||||||
public final void setStateRef(net.corda.core.schemas.PersistentStateRef)
|
public void setStateRef(net.corda.core.schemas.PersistentStateRef)
|
||||||
##
|
##
|
||||||
@javax.persistence.Embeddable public final class net.corda.core.schemas.PersistentStateRef extends java.lang.Object implements java.io.Serializable
|
@javax.persistence.Embeddable public class net.corda.core.schemas.PersistentStateRef extends java.lang.Object implements java.io.Serializable
|
||||||
public <init>()
|
public <init>()
|
||||||
public <init>(String, Integer)
|
public <init>(String, Integer)
|
||||||
public <init>(net.corda.core.contracts.StateRef)
|
public <init>(net.corda.core.contracts.StateRef)
|
||||||
@ -2899,18 +2899,18 @@ public class net.corda.core.schemas.MappedSchema extends java.lang.Object
|
|||||||
@org.jetbrains.annotations.Nullable public final Integer component2()
|
@org.jetbrains.annotations.Nullable public final Integer component2()
|
||||||
@org.jetbrains.annotations.NotNull public final net.corda.core.schemas.PersistentStateRef copy(String, Integer)
|
@org.jetbrains.annotations.NotNull public final net.corda.core.schemas.PersistentStateRef copy(String, Integer)
|
||||||
public boolean equals(Object)
|
public boolean equals(Object)
|
||||||
@org.jetbrains.annotations.Nullable public final Integer getIndex()
|
@org.jetbrains.annotations.Nullable public Integer getIndex()
|
||||||
@org.jetbrains.annotations.Nullable public final String getTxId()
|
@org.jetbrains.annotations.Nullable public String getTxId()
|
||||||
public int hashCode()
|
public int hashCode()
|
||||||
public final void setIndex(Integer)
|
public void setIndex(Integer)
|
||||||
public final void setTxId(String)
|
public void setTxId(String)
|
||||||
public String toString()
|
public String toString()
|
||||||
##
|
##
|
||||||
@net.corda.core.serialization.CordaSerializable public interface net.corda.core.schemas.QueryableState extends net.corda.core.contracts.ContractState
|
@net.corda.core.serialization.CordaSerializable public interface net.corda.core.schemas.QueryableState extends net.corda.core.contracts.ContractState
|
||||||
@org.jetbrains.annotations.NotNull public abstract net.corda.core.schemas.PersistentState generateMappedObject(net.corda.core.schemas.MappedSchema)
|
@org.jetbrains.annotations.NotNull public abstract net.corda.core.schemas.PersistentState generateMappedObject(net.corda.core.schemas.MappedSchema)
|
||||||
@org.jetbrains.annotations.NotNull public abstract Iterable supportedSchemas()
|
@org.jetbrains.annotations.NotNull public abstract Iterable supportedSchemas()
|
||||||
##
|
##
|
||||||
public interface net.corda.core.schemas.StatePersistable
|
public interface net.corda.core.schemas.StatePersistable extends java.io.Serializable
|
||||||
##
|
##
|
||||||
public interface net.corda.core.serialization.ClassWhitelist
|
public interface net.corda.core.serialization.ClassWhitelist
|
||||||
public abstract boolean hasListed(Class)
|
public abstract boolean hasListed(Class)
|
||||||
|
10
build.gradle
10
build.gradle
@ -111,6 +111,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
|
classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlin_version"
|
||||||
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
|
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
|
||||||
classpath "net.corda.plugins:publish-utils:$gradle_plugins_version"
|
classpath "net.corda.plugins:publish-utils:$gradle_plugins_version"
|
||||||
classpath "net.corda.plugins:quasar-utils:$gradle_plugins_version"
|
classpath "net.corda.plugins:quasar-utils:$gradle_plugins_version"
|
||||||
@ -158,6 +159,15 @@ allprojects {
|
|||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
apply plugin: 'jacoco'
|
apply plugin: 'jacoco'
|
||||||
apply plugin: 'org.owasp.dependencycheck'
|
apply plugin: 'org.owasp.dependencycheck'
|
||||||
|
apply plugin: 'kotlin-allopen'
|
||||||
|
|
||||||
|
allOpen {
|
||||||
|
annotations(
|
||||||
|
"javax.persistence.Entity",
|
||||||
|
"javax.persistence.Embeddable",
|
||||||
|
"javax.persistence.MappedSuperclass"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
dependencyCheck {
|
dependencyCheck {
|
||||||
suppressionFile = '.ci/dependency-checker/suppressedLibraries.xml'
|
suppressionFile = '.ci/dependency-checker/suppressedLibraries.xml'
|
||||||
|
@ -88,4 +88,4 @@ data class PersistentStateRef(
|
|||||||
/**
|
/**
|
||||||
* Marker interface to denote a persistable Corda state entity that will always have a transaction id and index
|
* Marker interface to denote a persistable Corda state entity that will always have a transaction id and index
|
||||||
*/
|
*/
|
||||||
interface StatePersistable
|
interface StatePersistable : Serializable
|
@ -449,6 +449,85 @@ associates it with the actual member variable.
|
|||||||
fun getStatesToConsume() = states
|
fun getStatesToConsume() = states
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Mutable Containers
|
||||||
|
``````````````````
|
||||||
|
|
||||||
|
Because Java fundamentally provides no mechanism by which the mutability of a class can be determined this presents a
|
||||||
|
problem for the serialization framework. When reconstituting objects with container properties (lists, maps, etc) we
|
||||||
|
must chose whether to create mutable or immutable objects. Given the restrictions, we have decided it is better to
|
||||||
|
preserve the immutability of immutable objects rather than force mutability on presumed immutable objects.
|
||||||
|
|
||||||
|
.. note:: Whilst we could potentially infer mutability empirically, doing so exhaustively is impossible as it's a design
|
||||||
|
decision rather than something intrinsic to the JVM. At present, we defer to simply making things immutable on reconstruction
|
||||||
|
with the following workarounds provided for those who use them. In future, this may change, but for now use the following
|
||||||
|
examples as a guide.
|
||||||
|
|
||||||
|
For example, consider the following:
|
||||||
|
|
||||||
|
.. sourcecode:: kotlin
|
||||||
|
|
||||||
|
data class C(val l : MutableList<String>)
|
||||||
|
|
||||||
|
val bytes = C(mutableListOf ("a", "b", "c")).serialize()
|
||||||
|
val newC = bytes.deserialize()
|
||||||
|
|
||||||
|
newC.l.add("d")
|
||||||
|
|
||||||
|
The call to ``newC.l.add`` will throw an ``UnsupportedOperationException``.
|
||||||
|
|
||||||
|
There are several workarounds that can be used to preserve mutability on reconstituted objects. Firstly, if the class
|
||||||
|
isn't a Kotlin data class and thus isn't restricted by having to have a primary constructor.
|
||||||
|
|
||||||
|
.. sourcecode:: kotlin
|
||||||
|
|
||||||
|
class C {
|
||||||
|
val l : MutableList<String>
|
||||||
|
|
||||||
|
@Suppress("Unused")
|
||||||
|
constructor (l : MutableList<String>) {
|
||||||
|
this.l = l.toMutableList()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val bytes = C(mutableListOf ("a", "b", "c")).serialize()
|
||||||
|
val newC = bytes.deserialize()
|
||||||
|
|
||||||
|
// This time this call will succeed
|
||||||
|
newC.l.add("d")
|
||||||
|
|
||||||
|
Secondly, if the class is a Kotlin data class, a secondary constructor can be used.
|
||||||
|
|
||||||
|
.. sourcecode:: kotlin
|
||||||
|
|
||||||
|
data class C (val l : MutableList<String>){
|
||||||
|
@ConstructorForDeserialization
|
||||||
|
@Suppress("Unused")
|
||||||
|
constructor (l : Collection<String>) : this (l.toMutableList())
|
||||||
|
}
|
||||||
|
|
||||||
|
val bytes = C(mutableListOf ("a", "b", "c")).serialize()
|
||||||
|
val newC = bytes.deserialize()
|
||||||
|
|
||||||
|
// This will also work
|
||||||
|
newC.l.add("d")
|
||||||
|
|
||||||
|
Thirdly, to preserve immutability of objects (a recommend design principle - Copy on Write semantics) then mutating the
|
||||||
|
contents of the class can be done by creating a new copy of the data class with the altered list passed (in this example)
|
||||||
|
passed in as the Constructor parameter.
|
||||||
|
|
||||||
|
.. sourcecode:: kotlin
|
||||||
|
|
||||||
|
data class C(val l : List<String>)
|
||||||
|
|
||||||
|
val bytes = C(listOf ("a", "b", "c")).serialize()
|
||||||
|
val newC = bytes.deserialize()
|
||||||
|
|
||||||
|
val newC2 = newC.copy (l = (newC.l + "d"))
|
||||||
|
|
||||||
|
.. note:: If mutability isn't an issue at all then in the case of data classes a single constructor can
|
||||||
|
be used by making the property var instead of val and in the ``init`` block reassigning the property
|
||||||
|
to a mutable instance
|
||||||
|
|
||||||
Enums
|
Enums
|
||||||
`````
|
`````
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.r3.corda.networkmanage.common.persistence.entity
|
package com.r3.corda.networkmanage.common.persistence.entity
|
||||||
|
|
||||||
import com.r3.corda.networkmanage.common.persistence.CrlIssuer
|
import com.r3.corda.networkmanage.common.persistence.CrlIssuer
|
||||||
|
import java.io.Serializable
|
||||||
import java.security.cert.X509CRL
|
import java.security.cert.X509CRL
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import javax.persistence.*
|
import javax.persistence.*
|
||||||
@ -26,4 +27,4 @@ class CertificateRevocationListEntity(
|
|||||||
|
|
||||||
@Column(name = "modified_at", nullable = false)
|
@Column(name = "modified_at", nullable = false)
|
||||||
val modifiedAt: Instant = Instant.now()
|
val modifiedAt: Instant = Instant.now()
|
||||||
)
|
) : Serializable
|
@ -3,6 +3,7 @@ package com.r3.corda.networkmanage.common.persistence.entity
|
|||||||
import com.r3.corda.networkmanage.common.persistence.RequestStatus
|
import com.r3.corda.networkmanage.common.persistence.RequestStatus
|
||||||
import net.corda.core.identity.CordaX500Name
|
import net.corda.core.identity.CordaX500Name
|
||||||
import org.hibernate.envers.Audited
|
import org.hibernate.envers.Audited
|
||||||
|
import java.io.Serializable
|
||||||
import java.math.BigInteger
|
import java.math.BigInteger
|
||||||
import java.security.cert.CRLReason
|
import java.security.cert.CRLReason
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
@ -57,4 +58,4 @@ data class CertificateRevocationRequestEntity(
|
|||||||
@Audited
|
@Audited
|
||||||
@Column(name = "remark", length = 256)
|
@Column(name = "remark", length = 256)
|
||||||
val remark: String? = null
|
val remark: String? = null
|
||||||
)
|
) : Serializable
|
@ -19,6 +19,7 @@ import net.corda.core.identity.CordaX500Name
|
|||||||
import net.corda.nodeapi.internal.crypto.x509Certificates
|
import net.corda.nodeapi.internal.crypto.x509Certificates
|
||||||
import org.bouncycastle.pkcs.PKCS10CertificationRequest
|
import org.bouncycastle.pkcs.PKCS10CertificationRequest
|
||||||
import org.hibernate.envers.Audited
|
import org.hibernate.envers.Audited
|
||||||
|
import java.io.Serializable
|
||||||
import java.math.BigInteger
|
import java.math.BigInteger
|
||||||
import java.security.cert.CertPath
|
import java.security.cert.CertPath
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
@ -69,7 +70,7 @@ data class CertificateSigningRequestEntity(
|
|||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "private_network", foreignKey = ForeignKey(name = "FK__CSR__PN"))
|
@JoinColumn(name = "private_network", foreignKey = ForeignKey(name = "FK__CSR__PN"))
|
||||||
val privateNetwork: PrivateNetworkEntity? = null
|
val privateNetwork: PrivateNetworkEntity? = null
|
||||||
) {
|
) : Serializable {
|
||||||
fun toCertificateSigningRequest(): CertificateSigningRequest {
|
fun toCertificateSigningRequest(): CertificateSigningRequest {
|
||||||
return CertificateSigningRequest(
|
return CertificateSigningRequest(
|
||||||
requestId = requestId,
|
requestId = requestId,
|
||||||
@ -108,7 +109,7 @@ data class CertificateDataEntity(
|
|||||||
|
|
||||||
@Column(name = "cert_serial_number", unique = true, nullable = false, columnDefinition = "NUMERIC(28)")
|
@Column(name = "cert_serial_number", unique = true, nullable = false, columnDefinition = "NUMERIC(28)")
|
||||||
val certificateSerialNumber: BigInteger
|
val certificateSerialNumber: BigInteger
|
||||||
) {
|
) : Serializable {
|
||||||
fun toCertificateData(): CertificateData = CertificateData(certificateStatus, certPath)
|
fun toCertificateData(): CertificateData = CertificateData(certificateStatus, certPath)
|
||||||
|
|
||||||
val legalName: CordaX500Name get() {
|
val legalName: CordaX500Name get() {
|
||||||
@ -125,4 +126,4 @@ data class PrivateNetworkEntity(
|
|||||||
|
|
||||||
@Column(name = "name", length = 255, nullable = false)
|
@Column(name = "name", length = 255, nullable = false)
|
||||||
val networkName: String
|
val networkName: String
|
||||||
)
|
) : Serializable
|
@ -14,6 +14,7 @@ import net.corda.core.internal.DigitalSignatureWithCert
|
|||||||
import net.corda.core.serialization.serialize
|
import net.corda.core.serialization.serialize
|
||||||
import net.corda.nodeapi.internal.network.NetworkMap
|
import net.corda.nodeapi.internal.network.NetworkMap
|
||||||
import net.corda.nodeapi.internal.network.SignedNetworkMap
|
import net.corda.nodeapi.internal.network.SignedNetworkMap
|
||||||
|
import java.io.Serializable
|
||||||
import java.security.cert.X509Certificate
|
import java.security.cert.X509Certificate
|
||||||
import javax.persistence.*
|
import javax.persistence.*
|
||||||
|
|
||||||
@ -41,7 +42,7 @@ class NetworkMapEntity(
|
|||||||
@ManyToOne(optional = false, fetch = FetchType.EAGER)
|
@ManyToOne(optional = false, fetch = FetchType.EAGER)
|
||||||
@JoinColumn(name = "network_parameters", nullable = false)
|
@JoinColumn(name = "network_parameters", nullable = false)
|
||||||
val networkParameters: NetworkParametersEntity
|
val networkParameters: NetworkParametersEntity
|
||||||
) {
|
) : Serializable {
|
||||||
fun toSignedNetworkMap(): SignedNetworkMap {
|
fun toSignedNetworkMap(): SignedNetworkMap {
|
||||||
return SignedNetworkMap(networkMap.serialize(), DigitalSignatureWithCert(certificate, signature))
|
return SignedNetworkMap(networkMap.serialize(), DigitalSignatureWithCert(certificate, signature))
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import net.corda.core.internal.DigitalSignatureWithCert
|
|||||||
import net.corda.core.node.NetworkParameters
|
import net.corda.core.node.NetworkParameters
|
||||||
import net.corda.core.serialization.serialize
|
import net.corda.core.serialization.serialize
|
||||||
import net.corda.nodeapi.internal.network.SignedNetworkParameters
|
import net.corda.nodeapi.internal.network.SignedNetworkParameters
|
||||||
|
import java.io.Serializable
|
||||||
import java.security.cert.X509Certificate
|
import java.security.cert.X509Certificate
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import javax.persistence.*
|
import javax.persistence.*
|
||||||
@ -43,12 +44,13 @@ class NetworkParametersEntity(
|
|||||||
@Column(name = "cert")
|
@Column(name = "cert")
|
||||||
@Convert(converter = X509CertificateConverter::class)
|
@Convert(converter = X509CertificateConverter::class)
|
||||||
val certificate: X509Certificate?
|
val certificate: X509Certificate?
|
||||||
) {
|
) : Serializable {
|
||||||
val isSigned: Boolean get() = certificate != null && signature != null
|
val isSigned: Boolean get() = certificate != null && signature != null
|
||||||
|
|
||||||
fun toSignedNetworkParameters(): SignedNetworkParameters {
|
fun toSignedNetworkParameters(): SignedNetworkParameters {
|
||||||
if (certificate == null || signature == null) throw IllegalStateException("Network parameters entity is not signed: $hash")
|
val cert = certificate ?: throw IllegalStateException("Network parameters entity is not signed: $hash")
|
||||||
return SignedNetworkParameters(networkParameters.serialize(), DigitalSignatureWithCert(certificate, signature))
|
val sign = signature ?: throw IllegalStateException("Network parameters entity is not signed: $hash")
|
||||||
|
return SignedNetworkParameters(networkParameters.serialize(), DigitalSignatureWithCert(cert, sign))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun copy(parametersHash: String = this.hash,
|
fun copy(parametersHash: String = this.hash,
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
package com.r3.corda.networkmanage.common.persistence.entity
|
package com.r3.corda.networkmanage.common.persistence.entity
|
||||||
|
|
||||||
import net.corda.nodeapi.internal.SignedNodeInfo
|
import net.corda.nodeapi.internal.SignedNodeInfo
|
||||||
|
import java.io.Serializable
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import javax.persistence.*
|
import javax.persistence.*
|
||||||
|
|
||||||
@ -40,7 +41,7 @@ data class NodeInfoEntity(
|
|||||||
@Column(name = "published_at", nullable = false)
|
@Column(name = "published_at", nullable = false)
|
||||||
val publishedAt: Instant = Instant.now(),
|
val publishedAt: Instant = Instant.now(),
|
||||||
|
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.EAGER)
|
||||||
@JoinColumn(name = "accepted_params_update")
|
@JoinColumn(name = "accepted_params_update")
|
||||||
val acceptedParametersUpdate: ParametersUpdateEntity?
|
val acceptedParametersUpdate: ParametersUpdateEntity?
|
||||||
)
|
) : Serializable
|
||||||
|
@ -2,6 +2,7 @@ package com.r3.corda.networkmanage.common.persistence.entity
|
|||||||
|
|
||||||
import net.corda.core.crypto.SecureHash
|
import net.corda.core.crypto.SecureHash
|
||||||
import net.corda.nodeapi.internal.network.ParametersUpdate
|
import net.corda.nodeapi.internal.network.ParametersUpdate
|
||||||
|
import java.io.Serializable
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import javax.persistence.*
|
import javax.persistence.*
|
||||||
|
|
||||||
@ -26,7 +27,7 @@ data class ParametersUpdateEntity(
|
|||||||
@Column(name = "status", length = 16, nullable = false, columnDefinition = "NVARCHAR(16)")
|
@Column(name = "status", length = 16, nullable = false, columnDefinition = "NVARCHAR(16)")
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
val status: UpdateStatus = UpdateStatus.NEW
|
val status: UpdateStatus = UpdateStatus.NEW
|
||||||
) {
|
) : Serializable {
|
||||||
fun toParametersUpdate(): ParametersUpdate {
|
fun toParametersUpdate(): ParametersUpdate {
|
||||||
return ParametersUpdate(SecureHash.parse(networkParameters.hash), description, updateDeadline)
|
return ParametersUpdate(SecureHash.parse(networkParameters.hash), description, updateDeadline)
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,60 @@
|
|||||||
|
package net.corda.nodeapi.internal.serialization.amqp
|
||||||
|
|
||||||
|
import net.corda.core.serialization.ConstructorForDeserialization
|
||||||
|
import org.assertj.core.api.Assertions
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
class RoundTripTests {
|
||||||
|
@Test
|
||||||
|
fun mutableBecomesImmutable() {
|
||||||
|
data class C(val l : MutableList<String>)
|
||||||
|
val factory = testDefaultFactoryNoEvolution()
|
||||||
|
val bytes = SerializationOutput(factory).serialize(C(mutableListOf ("a", "b", "c")))
|
||||||
|
val newC = DeserializationInput(factory).deserialize(bytes)
|
||||||
|
|
||||||
|
Assertions.assertThatThrownBy {
|
||||||
|
newC.l.add("d")
|
||||||
|
}.isInstanceOf(UnsupportedOperationException::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun mutableStillMutable() {
|
||||||
|
class C {
|
||||||
|
val l : MutableList<String>
|
||||||
|
|
||||||
|
@Suppress("Unused")
|
||||||
|
constructor (l : MutableList<String>) {
|
||||||
|
this.l = l.toMutableList()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val factory = testDefaultFactoryNoEvolution()
|
||||||
|
val bytes = SerializationOutput(factory).serialize(C(mutableListOf ("a", "b", "c")))
|
||||||
|
val newC = DeserializationInput(factory).deserialize(bytes)
|
||||||
|
|
||||||
|
newC.l.add("d")
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun mutableStillMutable2() {
|
||||||
|
data class C (val l : MutableList<String>){
|
||||||
|
@ConstructorForDeserialization
|
||||||
|
@Suppress("Unused")
|
||||||
|
constructor (l : Collection<String>) : this (l.toMutableList())
|
||||||
|
}
|
||||||
|
|
||||||
|
val factory = testDefaultFactoryNoEvolution()
|
||||||
|
val bytes = SerializationOutput(factory).serialize(C(mutableListOf ("a", "b", "c")))
|
||||||
|
val newC = DeserializationInput(factory).deserialize(bytes)
|
||||||
|
|
||||||
|
newC.l.add("d")
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun mutableBecomesImmutable4() {
|
||||||
|
data class C(val l : List<String>)
|
||||||
|
val factory = testDefaultFactoryNoEvolution()
|
||||||
|
val bytes = SerializationOutput(factory).serialize(C(listOf ("a", "b", "c")))
|
||||||
|
val newC = DeserializationInput(factory).deserialize(bytes)
|
||||||
|
val newC2 = newC.copy (l = (newC.l + "d"))
|
||||||
|
}
|
||||||
|
}
|
@ -20,6 +20,7 @@ import net.corda.core.serialization.serialize
|
|||||||
import net.corda.core.utilities.MAX_HASH_HEX_SIZE
|
import net.corda.core.utilities.MAX_HASH_HEX_SIZE
|
||||||
import net.corda.core.utilities.NetworkHostAndPort
|
import net.corda.core.utilities.NetworkHostAndPort
|
||||||
import net.corda.node.services.persistence.NodePropertiesPersistentStore
|
import net.corda.node.services.persistence.NodePropertiesPersistentStore
|
||||||
|
import java.io.Serializable
|
||||||
import javax.persistence.*
|
import javax.persistence.*
|
||||||
|
|
||||||
object NodeInfoSchema
|
object NodeInfoSchema
|
||||||
@ -65,7 +66,7 @@ object NodeInfoSchemaV1 : MappedSchema(
|
|||||||
*/
|
*/
|
||||||
@Column(name = "serial")
|
@Column(name = "serial")
|
||||||
val serial: Long
|
val serial: Long
|
||||||
) {
|
) : Serializable {
|
||||||
fun toNodeInfo(): NodeInfo {
|
fun toNodeInfo(): NodeInfo {
|
||||||
return NodeInfo(
|
return NodeInfo(
|
||||||
this.addresses.map { it.toHostAndPort() },
|
this.addresses.map { it.toHostAndPort() },
|
||||||
@ -85,7 +86,7 @@ object NodeInfoSchemaV1 : MappedSchema(
|
|||||||
var id: Int,
|
var id: Int,
|
||||||
val host: String? = null,
|
val host: String? = null,
|
||||||
val port: Int? = null
|
val port: Int? = null
|
||||||
) {
|
) : Serializable {
|
||||||
companion object {
|
companion object {
|
||||||
fun fromHostAndPort(hostAndPort: NetworkHostAndPort) = DBHostAndPort(
|
fun fromHostAndPort(hostAndPort: NetworkHostAndPort) = DBHostAndPort(
|
||||||
0, hostAndPort.host, hostAndPort.port
|
0, hostAndPort.host, hostAndPort.port
|
||||||
@ -118,7 +119,7 @@ object NodeInfoSchemaV1 : MappedSchema(
|
|||||||
|
|
||||||
@ManyToMany(mappedBy = "legalIdentitiesAndCerts", cascade = arrayOf(CascadeType.ALL)) // ManyToMany because of distributed services.
|
@ManyToMany(mappedBy = "legalIdentitiesAndCerts", cascade = arrayOf(CascadeType.ALL)) // ManyToMany because of distributed services.
|
||||||
private val persistentNodeInfos: Set<PersistentNodeInfo> = emptySet()
|
private val persistentNodeInfos: Set<PersistentNodeInfo> = emptySet()
|
||||||
) {
|
) : Serializable {
|
||||||
constructor(partyAndCert: PartyAndCertificate, isMain: Boolean = false)
|
constructor(partyAndCert: PartyAndCertificate, isMain: Boolean = false)
|
||||||
: this(partyAndCert.name.toString(),
|
: this(partyAndCert.name.toString(),
|
||||||
partyAndCert.party.owningKey.toStringShort(),
|
partyAndCert.party.owningKey.toStringShort(),
|
||||||
|
@ -43,6 +43,7 @@ import net.corda.nodeapi.internal.persistence.NODE_DATABASE_PREFIX
|
|||||||
import org.apache.activemq.artemis.utils.ReusableLatch
|
import org.apache.activemq.artemis.utils.ReusableLatch
|
||||||
import org.apache.mina.util.ConcurrentHashSet
|
import org.apache.mina.util.ConcurrentHashSet
|
||||||
import org.slf4j.Logger
|
import org.slf4j.Logger
|
||||||
|
import java.io.Serializable
|
||||||
import java.time.Duration
|
import java.time.Duration
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@ -166,7 +167,7 @@ class NodeSchedulerService(private val clock: CordaClock,
|
|||||||
|
|
||||||
@Column(name = "scheduled_at", nullable = false)
|
@Column(name = "scheduled_at", nullable = false)
|
||||||
var scheduledAt: Instant = Instant.now()
|
var scheduledAt: Instant = Instant.now()
|
||||||
)
|
) : Serializable
|
||||||
|
|
||||||
private class InnerState {
|
private class InnerState {
|
||||||
var scheduledStatesQueue: PriorityQueue<ScheduledStateRef> = PriorityQueue({ a, b -> a.scheduledAt.compareTo(b.scheduledAt) })
|
var scheduledStatesQueue: PriorityQueue<ScheduledStateRef> = PriorityQueue({ a, b -> a.scheduledAt.compareTo(b.scheduledAt) })
|
||||||
|
@ -27,6 +27,7 @@ import net.corda.nodeapi.internal.crypto.X509Utilities
|
|||||||
import net.corda.nodeapi.internal.crypto.x509Certificates
|
import net.corda.nodeapi.internal.crypto.x509Certificates
|
||||||
import net.corda.nodeapi.internal.persistence.NODE_DATABASE_PREFIX
|
import net.corda.nodeapi.internal.persistence.NODE_DATABASE_PREFIX
|
||||||
import org.apache.commons.lang.ArrayUtils.EMPTY_BYTE_ARRAY
|
import org.apache.commons.lang.ArrayUtils.EMPTY_BYTE_ARRAY
|
||||||
|
import java.io.Serializable
|
||||||
import java.security.InvalidAlgorithmParameterException
|
import java.security.InvalidAlgorithmParameterException
|
||||||
import java.security.PublicKey
|
import java.security.PublicKey
|
||||||
import java.security.cert.*
|
import java.security.cert.*
|
||||||
@ -85,7 +86,7 @@ class PersistentIdentityService(override val trustRoot: X509Certificate,
|
|||||||
@Lob
|
@Lob
|
||||||
@Column(name = "identity_value")
|
@Column(name = "identity_value")
|
||||||
var identity: ByteArray = EMPTY_BYTE_ARRAY
|
var identity: ByteArray = EMPTY_BYTE_ARRAY
|
||||||
)
|
) : Serializable
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@javax.persistence.Table(name = "${NODE_DATABASE_PREFIX}named_identities")
|
@javax.persistence.Table(name = "${NODE_DATABASE_PREFIX}named_identities")
|
||||||
@ -96,7 +97,7 @@ class PersistentIdentityService(override val trustRoot: X509Certificate,
|
|||||||
|
|
||||||
@Column(name = "pk_hash", length = MAX_HASH_HEX_SIZE)
|
@Column(name = "pk_hash", length = MAX_HASH_HEX_SIZE)
|
||||||
var publicKeyHash: String = ""
|
var publicKeyHash: String = ""
|
||||||
)
|
) : Serializable
|
||||||
|
|
||||||
override val caCertStore: CertStore
|
override val caCertStore: CertStore
|
||||||
override val trustAnchor: TrustAnchor = TrustAnchor(trustRoot, null)
|
override val trustAnchor: TrustAnchor = TrustAnchor(trustRoot, null)
|
||||||
|
@ -20,6 +20,7 @@ import net.corda.node.utilities.AppendOnlyPersistentMap
|
|||||||
import net.corda.nodeapi.internal.persistence.NODE_DATABASE_PREFIX
|
import net.corda.nodeapi.internal.persistence.NODE_DATABASE_PREFIX
|
||||||
import org.apache.commons.lang.ArrayUtils.EMPTY_BYTE_ARRAY
|
import org.apache.commons.lang.ArrayUtils.EMPTY_BYTE_ARRAY
|
||||||
import org.bouncycastle.operator.ContentSigner
|
import org.bouncycastle.operator.ContentSigner
|
||||||
|
import java.io.Serializable
|
||||||
import java.security.KeyPair
|
import java.security.KeyPair
|
||||||
import java.security.PrivateKey
|
import java.security.PrivateKey
|
||||||
import java.security.PublicKey
|
import java.security.PublicKey
|
||||||
@ -51,7 +52,7 @@ class PersistentKeyManagementService(val identityService: IdentityService,
|
|||||||
@Lob
|
@Lob
|
||||||
@Column(name = "private_key")
|
@Column(name = "private_key")
|
||||||
var privateKey: ByteArray = EMPTY_BYTE_ARRAY
|
var privateKey: ByteArray = EMPTY_BYTE_ARRAY
|
||||||
) {
|
) : Serializable {
|
||||||
constructor(publicKey: PublicKey, privateKey: PrivateKey)
|
constructor(publicKey: PublicKey, privateKey: PrivateKey)
|
||||||
: this(publicKey.toStringShort(), publicKey.encoded, privateKey.encoded)
|
: this(publicKey.toStringShort(), publicKey.encoded, privateKey.encoded)
|
||||||
}
|
}
|
||||||
|
@ -71,6 +71,7 @@ import org.apache.commons.lang.ArrayUtils.EMPTY_BYTE_ARRAY
|
|||||||
import rx.Observable
|
import rx.Observable
|
||||||
import rx.Subscription
|
import rx.Subscription
|
||||||
import rx.subjects.PublishSubject
|
import rx.subjects.PublishSubject
|
||||||
|
import java.io.Serializable
|
||||||
import java.security.PublicKey
|
import java.security.PublicKey
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@ -191,6 +192,17 @@ class P2PMessagingClient(val config: NodeConfiguration,
|
|||||||
private val deduplicator = P2PMessageDeduplicator(database)
|
private val deduplicator = P2PMessageDeduplicator(database)
|
||||||
internal var messagingExecutor: MessagingExecutor? = null
|
internal var messagingExecutor: MessagingExecutor? = null
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@javax.persistence.Table(name = "${NODE_DATABASE_PREFIX}message_ids")
|
||||||
|
class ProcessedMessage(
|
||||||
|
@Id
|
||||||
|
@Column(name = "message_id", length = 64)
|
||||||
|
var uuid: String = "",
|
||||||
|
|
||||||
|
@Column(name = "insertion_time")
|
||||||
|
var insertionTime: Instant = Instant.now()
|
||||||
|
) : Serializable
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@javax.persistence.Table(name = "${NODE_DATABASE_PREFIX}message_retry")
|
@javax.persistence.Table(name = "${NODE_DATABASE_PREFIX}message_retry")
|
||||||
class RetryMessage(
|
class RetryMessage(
|
||||||
@ -204,7 +216,7 @@ class P2PMessagingClient(val config: NodeConfiguration,
|
|||||||
@Lob
|
@Lob
|
||||||
@Column
|
@Column
|
||||||
var recipients: ByteArray = EMPTY_BYTE_ARRAY
|
var recipients: ByteArray = EMPTY_BYTE_ARRAY
|
||||||
)
|
) : Serializable
|
||||||
|
|
||||||
fun start() {
|
fun start() {
|
||||||
state.locked {
|
state.locked {
|
||||||
|
@ -21,6 +21,7 @@ import org.apache.commons.lang.ArrayUtils.EMPTY_BYTE_ARRAY
|
|||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import java.util.stream.Stream
|
import java.util.stream.Stream
|
||||||
|
import java.io.Serializable
|
||||||
import javax.persistence.Column
|
import javax.persistence.Column
|
||||||
import javax.persistence.Entity
|
import javax.persistence.Entity
|
||||||
import javax.persistence.Id
|
import javax.persistence.Id
|
||||||
@ -42,7 +43,7 @@ class DBCheckpointStorage : CheckpointStorage {
|
|||||||
@Lob
|
@Lob
|
||||||
@Column(name = "checkpoint_value")
|
@Column(name = "checkpoint_value")
|
||||||
var checkpoint: ByteArray = EMPTY_BYTE_ARRAY
|
var checkpoint: ByteArray = EMPTY_BYTE_ARRAY
|
||||||
)
|
) : Serializable
|
||||||
|
|
||||||
override fun addCheckpoint(id: StateMachineRunId, checkpoint: SerializedBytes<Checkpoint>) {
|
override fun addCheckpoint(id: StateMachineRunId, checkpoint: SerializedBytes<Checkpoint>) {
|
||||||
currentDBSession().saveOrUpdate(DBCheckpoint().apply {
|
currentDBSession().saveOrUpdate(DBCheckpoint().apply {
|
||||||
|
@ -22,6 +22,7 @@ import net.corda.nodeapi.internal.persistence.NODE_DATABASE_PREFIX
|
|||||||
import net.corda.nodeapi.internal.persistence.bufferUntilDatabaseCommit
|
import net.corda.nodeapi.internal.persistence.bufferUntilDatabaseCommit
|
||||||
import net.corda.nodeapi.internal.persistence.wrapWithDatabaseTransaction
|
import net.corda.nodeapi.internal.persistence.wrapWithDatabaseTransaction
|
||||||
import rx.subjects.PublishSubject
|
import rx.subjects.PublishSubject
|
||||||
|
import java.io.Serializable
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import javax.annotation.concurrent.ThreadSafe
|
import javax.annotation.concurrent.ThreadSafe
|
||||||
import javax.persistence.Column
|
import javax.persistence.Column
|
||||||
@ -46,7 +47,7 @@ class DBTransactionMappingStorage : StateMachineRecordedTransactionMappingStorag
|
|||||||
|
|
||||||
@Column(name = "state_machine_run_id", length = 36)
|
@Column(name = "state_machine_run_id", length = 36)
|
||||||
var stateMachineRunId: String = ""
|
var stateMachineRunId: String = ""
|
||||||
)
|
) : Serializable
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
fun createMap(): AppendOnlyPersistentMap<SecureHash, StateMachineRunId, DBTransactionMapping, String> {
|
fun createMap(): AppendOnlyPersistentMap<SecureHash, StateMachineRunId, DBTransactionMapping, String> {
|
||||||
|
@ -32,6 +32,7 @@ import net.corda.nodeapi.internal.serialization.CordaSerializationEncoding.SNAPP
|
|||||||
import org.apache.commons.lang.ArrayUtils.EMPTY_BYTE_ARRAY
|
import org.apache.commons.lang.ArrayUtils.EMPTY_BYTE_ARRAY
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
import rx.subjects.PublishSubject
|
import rx.subjects.PublishSubject
|
||||||
|
import java.io.Serializable
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import javax.persistence.*
|
import javax.persistence.*
|
||||||
|
|
||||||
@ -52,7 +53,7 @@ class DBTransactionStorage(cacheSizeBytes: Long) : WritableTransactionStorage, S
|
|||||||
@Lob
|
@Lob
|
||||||
@Column(name = "transaction_value")
|
@Column(name = "transaction_value")
|
||||||
var transaction: ByteArray = EMPTY_BYTE_ARRAY
|
var transaction: ByteArray = EMPTY_BYTE_ARRAY
|
||||||
)
|
) : Serializable
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
fun createTransactionsMap(maxSizeInBytes: Long)
|
fun createTransactionsMap(maxSizeInBytes: Long)
|
||||||
|
@ -19,6 +19,7 @@ import net.corda.nodeapi.internal.persistence.CordaPersistence
|
|||||||
import net.corda.nodeapi.internal.persistence.NODE_DATABASE_PREFIX
|
import net.corda.nodeapi.internal.persistence.NODE_DATABASE_PREFIX
|
||||||
import org.slf4j.Logger
|
import org.slf4j.Logger
|
||||||
import rx.subjects.PublishSubject
|
import rx.subjects.PublishSubject
|
||||||
|
import java.io.Serializable
|
||||||
import javax.persistence.Column
|
import javax.persistence.Column
|
||||||
import javax.persistence.Entity
|
import javax.persistence.Entity
|
||||||
import javax.persistence.Id
|
import javax.persistence.Id
|
||||||
@ -44,7 +45,7 @@ class NodePropertiesPersistentStore(readPhysicalNodeId: () -> String, persistenc
|
|||||||
|
|
||||||
@Column(name = "property_value")
|
@Column(name = "property_value")
|
||||||
var value: String? = ""
|
var value: String? = ""
|
||||||
)
|
) : Serializable
|
||||||
}
|
}
|
||||||
|
|
||||||
private class FlowsDrainingModeOperationsImpl(readPhysicalNodeId: () -> String, private val persistence: CordaPersistence, logger: Logger) : FlowsDrainingModeOperations {
|
private class FlowsDrainingModeOperationsImpl(readPhysicalNodeId: () -> String, private val persistence: CordaPersistence, logger: Logger) : FlowsDrainingModeOperations {
|
||||||
|
@ -16,6 +16,7 @@ import net.corda.node.utilities.AffinityExecutor
|
|||||||
import net.corda.nodeapi.internal.persistence.CordaPersistence
|
import net.corda.nodeapi.internal.persistence.CordaPersistence
|
||||||
import net.corda.nodeapi.internal.persistence.NODE_DATABASE_PREFIX
|
import net.corda.nodeapi.internal.persistence.NODE_DATABASE_PREFIX
|
||||||
import org.hibernate.Session
|
import org.hibernate.Session
|
||||||
|
import java.io.Serializable
|
||||||
import java.time.Duration
|
import java.time.Duration
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.time.temporal.ChronoField
|
import java.time.temporal.ChronoField
|
||||||
@ -58,7 +59,7 @@ class RunOnceService(private val database: CordaPersistence, private val machine
|
|||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = TABLE)
|
@Table(name = TABLE)
|
||||||
class MutualExclusion(machineNameInit: String, pidInit: String, timeStampInit: LocalDateTime, versionInit: Long = 0) {
|
class MutualExclusion(machineNameInit: String, pidInit: String, timeStampInit: LocalDateTime, versionInit: Long = 0) : Serializable {
|
||||||
@Column(name = ID, insertable = false, updatable = false)
|
@Column(name = ID, insertable = false, updatable = false)
|
||||||
@Id
|
@Id
|
||||||
val id: Char = 'X'
|
val id: Char = 'X'
|
||||||
|
@ -28,6 +28,7 @@ import net.corda.core.utilities.contextLogger
|
|||||||
import net.corda.node.utilities.AppendOnlyPersistentMap
|
import net.corda.node.utilities.AppendOnlyPersistentMap
|
||||||
import net.corda.nodeapi.internal.persistence.NODE_DATABASE_PREFIX
|
import net.corda.nodeapi.internal.persistence.NODE_DATABASE_PREFIX
|
||||||
import net.corda.nodeapi.internal.persistence.currentDBSession
|
import net.corda.nodeapi.internal.persistence.currentDBSession
|
||||||
|
import java.io.Serializable
|
||||||
import java.time.Clock
|
import java.time.Clock
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@ -44,7 +45,7 @@ class PersistentUniquenessProvider(val clock: Clock) : UniquenessProvider, Singl
|
|||||||
|
|
||||||
@Column(name = "consuming_transaction_id")
|
@Column(name = "consuming_transaction_id")
|
||||||
val consumingTxHash: String
|
val consumingTxHash: String
|
||||||
)
|
) : Serializable
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@javax.persistence.Table(name = "${NODE_DATABASE_PREFIX}notary_request_log")
|
@javax.persistence.Table(name = "${NODE_DATABASE_PREFIX}notary_request_log")
|
||||||
@ -66,7 +67,7 @@ class PersistentUniquenessProvider(val clock: Clock) : UniquenessProvider, Singl
|
|||||||
|
|
||||||
@Column(name = "request_timestamp")
|
@Column(name = "request_timestamp")
|
||||||
var requestDate: Instant
|
var requestDate: Instant
|
||||||
)
|
) : Serializable
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@javax.persistence.Table(name = "${NODE_DATABASE_PREFIX}notary_committed_states")
|
@javax.persistence.Table(name = "${NODE_DATABASE_PREFIX}notary_committed_states")
|
||||||
|
@ -42,6 +42,7 @@ import net.corda.nodeapi.internal.config.NodeSSLConfiguration
|
|||||||
import net.corda.nodeapi.internal.config.SSLConfiguration
|
import net.corda.nodeapi.internal.config.SSLConfiguration
|
||||||
import net.corda.nodeapi.internal.persistence.CordaPersistence
|
import net.corda.nodeapi.internal.persistence.CordaPersistence
|
||||||
import net.corda.nodeapi.internal.persistence.NODE_DATABASE_PREFIX
|
import net.corda.nodeapi.internal.persistence.NODE_DATABASE_PREFIX
|
||||||
|
import java.io.Serializable
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import java.time.Clock
|
import java.time.Clock
|
||||||
import java.util.concurrent.CompletableFuture
|
import java.util.concurrent.CompletableFuture
|
||||||
@ -104,7 +105,7 @@ class RaftUniquenessProvider(
|
|||||||
var value: String = "",
|
var value: String = "",
|
||||||
@Column(name = "raft_log_index")
|
@Column(name = "raft_log_index")
|
||||||
var index: Long = 0
|
var index: Long = 0
|
||||||
)
|
) : Serializable
|
||||||
|
|
||||||
/** Directory storing the Raft log and state machine snapshots */
|
/** Directory storing the Raft log and state machine snapshots */
|
||||||
private val storagePath: Path = transportConfiguration.baseDirectory
|
private val storagePath: Path = transportConfiguration.baseDirectory
|
||||||
|
@ -16,6 +16,7 @@ import net.corda.core.node.services.ContractUpgradeService
|
|||||||
import net.corda.core.serialization.SingletonSerializeAsToken
|
import net.corda.core.serialization.SingletonSerializeAsToken
|
||||||
import net.corda.nodeapi.internal.persistence.NODE_DATABASE_PREFIX
|
import net.corda.nodeapi.internal.persistence.NODE_DATABASE_PREFIX
|
||||||
import net.corda.node.utilities.PersistentMap
|
import net.corda.node.utilities.PersistentMap
|
||||||
|
import java.io.Serializable
|
||||||
import javax.persistence.Column
|
import javax.persistence.Column
|
||||||
import javax.persistence.Entity
|
import javax.persistence.Entity
|
||||||
import javax.persistence.Id
|
import javax.persistence.Id
|
||||||
@ -33,7 +34,7 @@ class ContractUpgradeServiceImpl : ContractUpgradeService, SingletonSerializeAsT
|
|||||||
/** refers to the UpgradedContract class name*/
|
/** refers to the UpgradedContract class name*/
|
||||||
@Column(name = "contract_class_name")
|
@Column(name = "contract_class_name")
|
||||||
var upgradedContractClassName: String = ""
|
var upgradedContractClassName: String = ""
|
||||||
)
|
) : Serializable
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
fun createContractUpgradesMap(): PersistentMap<String, String, DBContractUpgrade, String> {
|
fun createContractUpgradesMap(): PersistentMap<String, String, DBContractUpgrade, String> {
|
||||||
|
@ -30,6 +30,7 @@ import org.hibernate.annotations.Cascade
|
|||||||
import org.hibernate.annotations.CascadeType
|
import org.hibernate.annotations.CascadeType
|
||||||
import org.junit.Ignore
|
import org.junit.Ignore
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
import java.io.Serializable
|
||||||
import javax.persistence.*
|
import javax.persistence.*
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
import kotlin.test.assertFalse
|
import kotlin.test.assertFalse
|
||||||
@ -154,7 +155,7 @@ object TestSchema : MappedSchema(SchemaFamily::class.java, 1, setOf(Parent::clas
|
|||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "children")
|
@Table(name = "children")
|
||||||
class Child {
|
class Child : Serializable {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
@Column(name = "child_id", unique = true, nullable = false)
|
@Column(name = "child_id", unique = true, nullable = false)
|
||||||
|
Loading…
Reference in New Issue
Block a user