diff --git a/.idea/runConfigurations/Bank_of_Corda_Demo__Run_Issuer.xml b/.idea/runConfigurations/Bank_of_Corda_Demo__Run_Issuer.xml
new file mode 100644
index 0000000000..314089c670
--- /dev/null
+++ b/.idea/runConfigurations/Bank_of_Corda_Demo__Run_Issuer.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/Bank_of_Corda_Demo__Run_RPC_Cash_Issue.xml b/.idea/runConfigurations/Bank_of_Corda_Demo__Run_RPC_Cash_Issue.xml
new file mode 100644
index 0000000000..dfe14546a3
--- /dev/null
+++ b/.idea/runConfigurations/Bank_of_Corda_Demo__Run_RPC_Cash_Issue.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/Bank_of_Corda_Demo__Run_Web_Cash_Issue.xml b/.idea/runConfigurations/Bank_of_Corda_Demo__Run_Web_Cash_Issue.xml
new file mode 100644
index 0000000000..ce474a1406
--- /dev/null
+++ b/.idea/runConfigurations/Bank_of_Corda_Demo__Run_Web_Cash_Issue.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index a16f42c558..b619f77eee 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,9 +1,12 @@
buildscript {
+ // For sharing constants between builds
+ Properties props = new Properties()
+ file("publish.properties").withInputStream { props.load(it) }
+
// Our version: bump this on release.
ext.corda_version = "0.7-SNAPSHOT"
- ext.gradle_plugins_version = "0.6.1"
-
- ext.kotlin_version = '1.0.5'
+ ext.gradle_plugins_version = props.getProperty("gradlePluginsVersion")
+ ext.kotlin_version = '1.0.5-2'
ext.quasar_version = '0.7.6'
ext.asm_version = '0.5.3'
ext.artemis_version = '1.4.0'
@@ -45,7 +48,7 @@ plugins {
apply plugin: 'kotlin'
apply plugin: 'project-report'
apply plugin: 'com.github.ben-manes.versions'
-apply plugin: 'maven-publish'
+apply plugin: 'net.corda.plugins.publish-utils'
apply plugin: 'net.corda.plugins.quasar-utils'
apply plugin: 'net.corda.plugins.cordformation'
@@ -93,7 +96,7 @@ repositories {
dependencies {
compile project(':node')
compile "com.google.guava:guava:19.0"
- runtime project(path: ":node", configuration: 'runtimeArtifacts')
+ runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
}
task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
@@ -153,5 +156,25 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['build']) {
}
}
-// Aliasing the publishToMavenLocal for simplicity.
-task(install, dependsOn: 'publishToMavenLocal')
+bintrayConfig {
+ user = System.getenv('CORDA_BINTRAY_USER')
+ key = System.getenv('CORDA_BINTRAY_KEY')
+ repo = 'corda'
+ org = 'r3'
+ licenses = ['Apache-2.0']
+ vcsUrl = 'https://github.com/corda/corda'
+ projectUrl = 'https://github.com/corda/corda'
+ gpgSign = true
+ gpgPassphrase = System.getenv('CORDA_BINTRAY_GPG_PASSPHRASE')
+ publications = ['client', 'core', 'corda', 'finance', 'node', 'test-utils']
+ license {
+ name = 'Apache-2.0'
+ url = 'https://www.apache.org/licenses/LICENSE-2.0'
+ distribution = 'repo'
+ }
+ developer {
+ id = 'R3'
+ name = 'R3'
+ email = 'dev@corda.net'
+ }
+}
\ No newline at end of file
diff --git a/client/build.gradle b/client/build.gradle
index bf04cfe540..1748bef18d 100644
--- a/client/build.gradle
+++ b/client/build.gradle
@@ -2,6 +2,8 @@ apply plugin: 'kotlin'
apply plugin: 'net.corda.plugins.quasar-utils'
apply plugin: 'net.corda.plugins.publish-utils'
+description 'Corda client modules'
+
repositories {
mavenLocal()
mavenCentral()
@@ -38,18 +40,6 @@ sourceSets {
}
}
-publishing {
- publications {
- client(MavenPublication) {
- from components.java
- artifactId 'client'
-
- artifact sourceJar
- artifact javadocJar
- }
- }
-}
-
// To find potential version conflicts, run "gradle htmlDependencyReport" and then look in
// build/reports/project/dependencies/index.html for green highlighted parts of the tree.
@@ -83,4 +73,4 @@ dependencies {
task integrationTest(type: Test) {
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
-}
+}
\ No newline at end of file
diff --git a/core/build.gradle b/core/build.gradle
index 6f7cc5512d..2265ea4402 100644
--- a/core/build.gradle
+++ b/core/build.gradle
@@ -2,14 +2,14 @@ apply plugin: 'kotlin'
apply plugin: 'net.corda.plugins.quasar-utils'
apply plugin: 'net.corda.plugins.publish-utils'
+description 'Corda core'
+
buildscript {
repositories {
mavenCentral()
}
}
-// apply plugin: 'org.jetbrains.dokka'
-
repositories {
mavenLocal()
mavenCentral()
@@ -88,16 +88,4 @@ dependencies {
// RS API: Response type and codes for ApiUtils.
compile "javax.ws.rs:javax.ws.rs-api:2.0"
-}
-
-publishing {
- publications {
- core(MavenPublication) {
- from components.java
- artifactId 'core'
-
- artifact sourceJar
- artifact javadocJar
- }
- }
}
\ No newline at end of file
diff --git a/core/src/main/kotlin/net/corda/core/Utils.kt b/core/src/main/kotlin/net/corda/core/Utils.kt
index 97d8d1dce8..fea248b305 100644
--- a/core/src/main/kotlin/net/corda/core/Utils.kt
+++ b/core/src/main/kotlin/net/corda/core/Utils.kt
@@ -13,6 +13,8 @@ import kotlinx.support.jdk7.use
import net.corda.core.crypto.newSecureRandom
import org.slf4j.Logger
import rx.Observable
+import rx.Observer
+import rx.subjects.PublishSubject
import rx.subjects.UnicastSubject
import java.io.BufferedInputStream
import java.io.InputStream
@@ -363,5 +365,15 @@ fun Observable.bufferUntilSubscribed(): Observable {
return subject.doOnUnsubscribe { subscription.unsubscribe() }
}
+/**
+ * Copy an [Observer] to multiple other [Observer]s.
+ */
+fun Observer.tee(vararg teeTo: Observer): Observer {
+ val subject = PublishSubject.create()
+ subject.subscribe(this)
+ teeTo.forEach { subject.subscribe(it) }
+ return subject
+}
+
/** Allows summing big decimals that are in iterable collections */
fun Iterable.sum(): BigDecimal = fold(BigDecimal.ZERO) { a, b -> a + b }
diff --git a/core/src/main/kotlin/net/corda/core/contracts/ContractsDSL.kt b/core/src/main/kotlin/net/corda/core/contracts/ContractsDSL.kt
index d1396f40e3..ce2dbea0b5 100644
--- a/core/src/main/kotlin/net/corda/core/contracts/ContractsDSL.kt
+++ b/core/src/main/kotlin/net/corda/core/contracts/ContractsDSL.kt
@@ -61,6 +61,8 @@ inline fun requireThat(body: Requirements.() -> R) = Requirements.body()
//// Authenticated commands ///////////////////////////////////////////////////////////////////////////////////////////
+// TODO: Provide a version of select that interops with Java
+
/** Filters the command list by type, party and public key all at once. */
inline fun Collection>.select(signer: CompositeKey? = null,
party: Party? = null) =
@@ -69,6 +71,8 @@ inline fun Collection
filter { if (party == null) true else party in it.signingParties }.
map { AuthenticatedObject(it.signers, it.signingParties, it.value as T) }
+// TODO: Provide a version of select that interops with Java
+
/** Filters the command list by type, parties and public keys all at once. */
inline fun Collection>.select(signers: Collection?,
parties: Collection?) =
diff --git a/core/src/main/kotlin/net/corda/core/crypto/X509Utilities.kt b/core/src/main/kotlin/net/corda/core/crypto/X509Utilities.kt
index fb9cdb33c9..c29454b74c 100644
--- a/core/src/main/kotlin/net/corda/core/crypto/X509Utilities.kt
+++ b/core/src/main/kotlin/net/corda/core/crypto/X509Utilities.kt
@@ -430,14 +430,8 @@ object X509Utilities {
fun loadCertificateFromPEMFile(filename: Path): X509Certificate {
val reader = PemReader(FileReader(filename.toFile()))
val pemObject = reader.readPemObject()
- val certFact = CertificateFactory.getInstance("X.509", BouncyCastleProvider.PROVIDER_NAME)
- val inputStream = ByteArrayInputStream(pemObject.content)
- try {
- val cert = certFact.generateCertificate(inputStream) as X509Certificate
- cert.checkValidity()
- return cert
- } finally {
- inputStream.close()
+ return CertificateStream(pemObject.content.inputStream()).nextCertificate().apply {
+ checkValidity()
}
}
@@ -609,3 +603,11 @@ object X509Utilities {
return keyStore
}
}
+
+val X500Name.commonName: String get() = getRDNs(BCStyle.CN).first().first.value.toString()
+
+class CertificateStream(val input: InputStream) {
+ private val certificateFactory = CertificateFactory.getInstance("X.509")
+
+ fun nextCertificate(): X509Certificate = certificateFactory.generateCertificate(input) as X509Certificate
+}
\ No newline at end of file
diff --git a/core/src/main/kotlin/net/corda/core/flows/FlowLogic.kt b/core/src/main/kotlin/net/corda/core/flows/FlowLogic.kt
index 3a9e7186b0..08f619797d 100644
--- a/core/src/main/kotlin/net/corda/core/flows/FlowLogic.kt
+++ b/core/src/main/kotlin/net/corda/core/flows/FlowLogic.kt
@@ -54,6 +54,8 @@ abstract class FlowLogic {
return sendAndReceive(otherParty, payload, T::class.java)
}
+ // TODO: Move the receiveType param to first position for readability
+
@Suspendable
fun sendAndReceive(otherParty: Party, payload: Any, receiveType: Class): UntrustworthyData {
return fsm.sendAndReceive(otherParty, payload, receiveType, sessionFlow)
@@ -61,6 +63,8 @@ abstract class FlowLogic {
inline fun receive(otherParty: Party): UntrustworthyData = receive(otherParty, T::class.java)
+ // TODO: Move the receiveType param to first position for readability
+
@Suspendable
fun receive(otherParty: Party, receiveType: Class): UntrustworthyData {
return fsm.receive(otherParty, receiveType, sessionFlow)
diff --git a/core/src/main/kotlin/net/corda/core/messaging/CordaRPCOps.kt b/core/src/main/kotlin/net/corda/core/messaging/CordaRPCOps.kt
index 56f9384747..5b5b8ba8a6 100644
--- a/core/src/main/kotlin/net/corda/core/messaging/CordaRPCOps.kt
+++ b/core/src/main/kotlin/net/corda/core/messaging/CordaRPCOps.kt
@@ -31,6 +31,9 @@ sealed class StateMachineUpdate(val id: StateMachineRunId) {
* RPC operations that the node exposes to clients using the Java client library. These can be called from
* client apps and are implemented by the node in the [CordaRPCOpsImpl] class.
*/
+
+// TODO: The use of Pairs throughout is unfriendly for Java interop.
+
interface CordaRPCOps : RPCOps {
/**
* Returns a pair of currently in-progress state machine infos and an observable of future state machine adds/removes.
diff --git a/core/src/main/kotlin/net/corda/core/messaging/Messaging.kt b/core/src/main/kotlin/net/corda/core/messaging/Messaging.kt
index 4d2d628976..0a55d7dca4 100644
--- a/core/src/main/kotlin/net/corda/core/messaging/Messaging.kt
+++ b/core/src/main/kotlin/net/corda/core/messaging/Messaging.kt
@@ -8,7 +8,6 @@ import net.corda.core.serialization.DeserializeAsKotlinObjectDef
import net.corda.core.serialization.deserialize
import net.corda.core.serialization.serialize
import org.bouncycastle.asn1.x500.X500Name
-import org.bouncycastle.asn1.x500.style.BCStyle
import java.time.Instant
import java.util.*
import java.util.concurrent.atomic.AtomicBoolean
@@ -184,7 +183,6 @@ interface Message {
interface ReceivedMessage : Message {
/** The authenticated sender. */
val peer: X500Name
- val peerLegalName: String get() = peer.getRDNs(BCStyle.CN).first().first.value.toString()
}
/** A singleton that's useful for validating topic strings */
diff --git a/core/src/main/kotlin/net/corda/core/node/services/Services.kt b/core/src/main/kotlin/net/corda/core/node/services/Services.kt
index ece53304f7..5f5215f1ac 100644
--- a/core/src/main/kotlin/net/corda/core/node/services/Services.kt
+++ b/core/src/main/kotlin/net/corda/core/node/services/Services.kt
@@ -100,8 +100,19 @@ interface VaultService {
val currentVault: Vault
/**
+ * Prefer the use of [updates] unless you know why you want to use this instead.
+ *
* Get a synchronous Observable of updates. When observations are pushed to the Observer, the Vault will already incorporate
- * the update.
+ * the update, and the database transaction associated with the update will still be open and current. If for some
+ * reason the processing crosses outside of the database transaction (for example, the update is pushed outside the current
+ * JVM or across to another [Thread] which is executing in a different database transaction) then the Vault may
+ * not incorporate the update due to racing with committing the current database transaction.
+ */
+ val rawUpdates: Observable
+
+ /**
+ * Get a synchronous Observable of updates. When observations are pushed to the Observer, the Vault will already incorporate
+ * the update, and the database transaction associated with the update will have been committed and closed.
*/
val updates: Observable
diff --git a/core/src/test/kotlin/net/corda/core/crypto/X509UtilitiesTest.kt b/core/src/test/kotlin/net/corda/core/crypto/X509UtilitiesTest.kt
index afd80a5259..a1d354316b 100644
--- a/core/src/test/kotlin/net/corda/core/crypto/X509UtilitiesTest.kt
+++ b/core/src/test/kotlin/net/corda/core/crypto/X509UtilitiesTest.kt
@@ -2,7 +2,6 @@ package net.corda.core.crypto
import net.corda.core.div
import org.bouncycastle.asn1.x500.X500Name
-import org.bouncycastle.asn1.x500.style.BCStyle
import org.bouncycastle.asn1.x509.GeneralName
import org.junit.Rule
import org.junit.Test
@@ -249,8 +248,7 @@ class X509UtilitiesTest {
val peerChain = clientSocket.session.peerCertificates
val peerX500Principal = (peerChain[0] as X509Certificate).subjectX500Principal
val x500name = X500Name(peerX500Principal.name)
- val cn = x500name.getRDNs(BCStyle.CN).first().first.value.toString()
- assertEquals("Mega Corp.", cn)
+ assertEquals("Mega Corp.", x500name.commonName)
val output = DataOutputStream(clientSocket.outputStream)
diff --git a/docs/source/example-code/build.gradle b/docs/source/example-code/build.gradle
index 470ef52172..9bc0aeb012 100644
--- a/docs/source/example-code/build.gradle
+++ b/docs/source/example-code/build.gradle
@@ -36,7 +36,7 @@ sourceSets {
}
}
-compileTestJava.dependsOn tasks.getByPath(':node:buildCordaJAR')
+compileTestJava.dependsOn tasks.getByPath(':node:capsule:buildCordaJAR')
dependencies {
compile project(':core')
@@ -48,7 +48,7 @@ dependencies {
exclude group: "bouncycastle"
}
- runtime project(path: ":node", configuration: 'runtimeArtifacts')
+ runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
}
mainClassName = "net.corda.docs.ClientRpcTutorialKt"
diff --git a/docs/source/example-code/src/test/kotlin/net/corda/docs/FxTransactionBuildTutorialTest.kt b/docs/source/example-code/src/test/kotlin/net/corda/docs/FxTransactionBuildTutorialTest.kt
index 22335d0483..4467b69b16 100644
--- a/docs/source/example-code/src/test/kotlin/net/corda/docs/FxTransactionBuildTutorialTest.kt
+++ b/docs/source/example-code/src/test/kotlin/net/corda/docs/FxTransactionBuildTutorialTest.kt
@@ -3,9 +3,7 @@ package net.corda.docs
import com.google.common.util.concurrent.SettableFuture
import net.corda.core.contracts.*
import net.corda.core.getOrThrow
-import net.corda.core.node.ServiceHub
import net.corda.core.node.services.ServiceInfo
-import net.corda.core.node.services.linearHeadsOfType
import net.corda.core.serialization.OpaqueBytes
import net.corda.core.utilities.DUMMY_NOTARY
import net.corda.core.utilities.DUMMY_NOTARY_KEY
@@ -18,7 +16,6 @@ import net.corda.testing.node.MockNetwork
import org.junit.After
import org.junit.Before
import org.junit.Test
-import java.util.*
import kotlin.test.assertEquals
class FxTransactionBuildTutorialTest {
@@ -69,13 +66,13 @@ class FxTransactionBuildTutorialTest {
printBalances()
// Setup some futures on the vaults to await the arrival of the exchanged funds at both nodes
- val done2 = SettableFuture.create