Refactor CordaRPCClient into new :client:rpc Gradle module. (#405)

* CORDA-305: Refactor CordaRPCClient into :client:rpc module

* CORDA-305: Remove the Kotlin test framework from the artifacts.

* CORDA-305: Migrate serialisation whitelist into node-api module.

* CORDA-305: Clean up unused RPC observables.

* CORDA-305: Add :client:rpc module to documentation tasks.

* CORDA-305: Include :finance into :client:rpc for its serialisable classes.

* CORDA-305: Move test classes into the correct directory.

* CORDA-305: Migrate :finance dependency from :client:rpc into DemoBench.

* CORDA-305: Update wording of TODO about handling Observables.
This commit is contained in:
Chris Rankin 2017-03-22 15:52:54 +00:00 committed by GitHub
parent 9a5bba9c04
commit 98266da41c
76 changed files with 248 additions and 165 deletions

View File

@ -19,7 +19,7 @@ buildscript {
ext.jersey_version = '2.25' ext.jersey_version = '2.25'
ext.jolokia_version = '2.0.0-M3' ext.jolokia_version = '2.0.0-M3'
ext.assertj_version = '3.6.1' ext.assertj_version = '3.6.1'
ext.slf4j_version = '1.7.22' ext.slf4j_version = '1.7.24'
ext.log4j_version = '2.7' ext.log4j_version = '2.7'
ext.bouncycastle_version = '1.56' ext.bouncycastle_version = '1.56'
ext.guava_version = '19.0' ext.guava_version = '19.0'
@ -27,6 +27,7 @@ buildscript {
ext.okhttp_version = '3.5.0' ext.okhttp_version = '3.5.0'
ext.netty_version = '4.1.5.Final' ext.netty_version = '4.1.5.Final'
ext.typesafe_config_version = '1.3.1' ext.typesafe_config_version = '1.3.1'
ext.fileupload_version = '1.3.2'
ext.junit_version = '4.12' ext.junit_version = '4.12'
ext.jopt_simple_version = '5.0.2' ext.jopt_simple_version = '5.0.2'
ext.jansi_version = '1.14' ext.jansi_version = '1.14'
@ -127,6 +128,7 @@ dependencies {
// For the buildCordappDependenciesJar task // For the buildCordappDependenciesJar task
runtime project(':client:jfx') runtime project(':client:jfx')
runtime project(':client:mock') runtime project(':client:mock')
runtime project(':client:rpc')
runtime project(':core') runtime project(':core')
runtime project(':finance') runtime project(':finance')
runtime project(':node:webserver') runtime project(':node:webserver')
@ -198,7 +200,7 @@ bintrayConfig {
projectUrl = 'https://github.com/corda/corda' projectUrl = 'https://github.com/corda/corda'
gpgSign = true gpgSign = true
gpgPassphrase = System.getenv('CORDA_BINTRAY_GPG_PASSPHRASE') gpgPassphrase = System.getenv('CORDA_BINTRAY_GPG_PASSPHRASE')
publications = ['jfx', 'mock', 'core', 'corda', 'corda-webserver', 'finance', 'node', 'node-api', 'node-schemas', 'test-utils', 'jackson', 'webserver'] publications = ['jfx', 'mock', 'rpc', 'core', 'corda', 'corda-webserver', 'finance', 'node', 'node-api', 'node-schemas', 'test-utils', 'jackson', 'webserver']
license { license {
name = 'Apache-2.0' name = 'Apache-2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0' url = 'https://www.apache.org/licenses/LICENSE-2.0'
@ -217,7 +219,7 @@ dokka {
moduleName = 'corda' moduleName = 'corda'
outputDirectory = 'docs/build/html/api/kotlin' outputDirectory = 'docs/build/html/api/kotlin'
processConfigurations = ['compile'] processConfigurations = ['compile']
sourceDirs = files('core/src/main/kotlin', 'client/jfx/src/main/kotlin', 'client/mock/src/main/kotlin', 'node/src/main/kotlin', 'finance/src/main/kotlin', 'client/jackson/src/main/kotlin') sourceDirs = files('core/src/main/kotlin', 'client/jfx/src/main/kotlin', 'client/mock/src/main/kotlin', 'client/rpc/src/main/kotlin', 'node/src/main/kotlin', 'finance/src/main/kotlin', 'client/jackson/src/main/kotlin')
} }
task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaTask) { task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaTask) {
@ -225,7 +227,7 @@ task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaTask) {
outputFormat = "javadoc" outputFormat = "javadoc"
outputDirectory = 'docs/build/html/api/javadoc' outputDirectory = 'docs/build/html/api/javadoc'
processConfigurations = ['compile'] processConfigurations = ['compile']
sourceDirs = files('core/src/main/kotlin', 'client/jfx/src/main/kotlin', 'client/mock/src/main/kotlin', 'node/src/main/kotlin', 'finance/src/main/kotlin', 'client/jackson/src/main/kotlin') sourceDirs = files('core/src/main/kotlin', 'client/jfx/src/main/kotlin', 'client/mock/src/main/kotlin', 'client/rpc/src/main/kotlin', 'node/src/main/kotlin', 'finance/src/main/kotlin', 'client/jackson/src/main/kotlin')
} }
task apidocs(dependsOn: ['dokka', 'dokkaJavadoc']) task apidocs(dependsOn: ['dokka', 'dokkaJavadoc'])

View File

@ -14,6 +14,7 @@ repositories {
dependencies { dependencies {
compile project(':core') compile project(':core')
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
// Jackson and its plugins: parsing to/from JSON and other textual formats. // Jackson and its plugins: parsing to/from JSON and other textual formats.
compile "com.fasterxml.jackson.module:jackson-module-kotlin:${jackson_version}" compile "com.fasterxml.jackson.module:jackson-module-kotlin:${jackson_version}"

View File

@ -44,8 +44,9 @@ sourceSets {
// build/reports/project/dependencies/index.html for green highlighted parts of the tree. // build/reports/project/dependencies/index.html for green highlighted parts of the tree.
dependencies { dependencies {
compile project(":core") compile project(':core')
compile project(':node') compile project(':finance')
compile project(':client:rpc')
compile "com.google.guava:guava:$guava_version" compile "com.google.guava:guava:$guava_version"

View File

@ -1,5 +1,6 @@
package net.corda.client.jfx package net.corda.client.jfx
import net.corda.client.rpc.CordaRPCClient
import net.corda.core.contracts.DOLLARS import net.corda.core.contracts.DOLLARS
import net.corda.core.flows.FlowException import net.corda.core.flows.FlowException
import net.corda.core.getOrThrow import net.corda.core.getOrThrow
@ -10,10 +11,9 @@ import net.corda.core.serialization.OpaqueBytes
import net.corda.flows.CashIssueFlow import net.corda.flows.CashIssueFlow
import net.corda.flows.CashPaymentFlow import net.corda.flows.CashPaymentFlow
import net.corda.node.internal.Node import net.corda.node.internal.Node
import net.corda.node.services.User
import net.corda.node.services.messaging.CordaRPCClient
import net.corda.node.services.startFlowPermission import net.corda.node.services.startFlowPermission
import net.corda.node.services.transactions.ValidatingNotaryService import net.corda.node.services.transactions.ValidatingNotaryService
import net.corda.nodeapi.User
import net.corda.testing.node.NodeBasedTest import net.corda.testing.node.NodeBasedTest
import org.apache.activemq.artemis.api.core.ActiveMQSecurityException import org.apache.activemq.artemis.api.core.ActiveMQSecurityException
import org.assertj.core.api.Assertions.assertThatExceptionOfType import org.assertj.core.api.Assertions.assertThatExceptionOfType

View File

@ -22,10 +22,10 @@ import net.corda.flows.CashExitFlow
import net.corda.flows.CashIssueFlow import net.corda.flows.CashIssueFlow
import net.corda.flows.CashPaymentFlow import net.corda.flows.CashPaymentFlow
import net.corda.node.driver.driver import net.corda.node.driver.driver
import net.corda.node.services.User
import net.corda.node.services.network.NetworkMapService import net.corda.node.services.network.NetworkMapService
import net.corda.node.services.startFlowPermission import net.corda.node.services.startFlowPermission
import net.corda.node.services.transactions.SimpleNotaryService import net.corda.node.services.transactions.SimpleNotaryService
import net.corda.nodeapi.User
import net.corda.testing.expect import net.corda.testing.expect
import net.corda.testing.expectEvents import net.corda.testing.expectEvents
import net.corda.testing.node.DriverBasedTest import net.corda.testing.node.DriverBasedTest

View File

@ -11,7 +11,6 @@ import net.corda.client.jfx.utils.map
import net.corda.core.crypto.CompositeKey import net.corda.core.crypto.CompositeKey
import net.corda.core.node.NodeInfo import net.corda.core.node.NodeInfo
import net.corda.core.node.services.NetworkMapCache.MapChange import net.corda.core.node.services.NetworkMapCache.MapChange
import net.corda.node.services.network.NetworkMapService
import java.security.PublicKey import java.security.PublicKey
class NetworkIdentityModel { class NetworkIdentityModel {
@ -37,7 +36,7 @@ class NetworkIdentityModel {
private fun NodeInfo.isCordaService(): Boolean { private fun NodeInfo.isCordaService(): Boolean {
// TODO: better way to identify Corda service? // TODO: better way to identify Corda service?
return advertisedServices.any { it.info.type == NetworkMapService.type || it.info.type.isNotary() } return advertisedServices.any { it.info.type.isNetworkMap() || it.info.type.isNotary() }
} }
// TODO: Use Identity Service in service hub instead? // TODO: Use Identity Service in service hub instead?

View File

@ -2,6 +2,7 @@ package net.corda.client.jfx.model
import com.google.common.net.HostAndPort import com.google.common.net.HostAndPort
import javafx.beans.property.SimpleObjectProperty import javafx.beans.property.SimpleObjectProperty
import net.corda.client.rpc.CordaRPCClient
import net.corda.core.flows.StateMachineRunId import net.corda.core.flows.StateMachineRunId
import net.corda.core.messaging.CordaRPCOps import net.corda.core.messaging.CordaRPCOps
import net.corda.core.messaging.StateMachineInfo import net.corda.core.messaging.StateMachineInfo
@ -11,7 +12,6 @@ import net.corda.core.node.services.StateMachineTransactionMapping
import net.corda.core.node.services.Vault import net.corda.core.node.services.Vault
import net.corda.core.seconds import net.corda.core.seconds
import net.corda.core.transactions.SignedTransaction import net.corda.core.transactions.SignedTransaction
import net.corda.node.services.messaging.CordaRPCClient
import rx.Observable import rx.Observable
import rx.subjects.PublishSubject import rx.subjects.PublishSubject

View File

@ -6,7 +6,6 @@ import javafx.collections.ListChangeListener
import javafx.collections.ObservableList import javafx.collections.ObservableList
import javafx.collections.transformation.TransformationList import javafx.collections.transformation.TransformationList
import java.util.* import java.util.*
import kotlin.test.assertEquals
/** /**
* [FlattenedList] flattens the passed in list of [ObservableValue]s so that changes in individual updates to the values * [FlattenedList] flattens the passed in list of [ObservableValue]s so that changes in individual updates to the values
@ -107,7 +106,7 @@ class FlattenedList<A>(val sourceList: ObservableList<out ObservableValue<out A>
} }
} }
endChange() endChange()
assertEquals(sourceList.size, indexMap.size) assert(sourceList.size == indexMap.size)
} }
override fun get(index: Int) = sourceList.get(index).value override fun get(index: Int) = sourceList.get(index).value

View File

@ -34,7 +34,8 @@ sourceSets {
// build/reports/project/dependencies/index.html for green highlighted parts of the tree. // build/reports/project/dependencies/index.html for green highlighted parts of the tree.
dependencies { dependencies {
compile project(":node") compile project(":core")
compile project(':finance')
// Unit testing helpers. // Unit testing helpers.
testCompile "junit:junit:$junit_version" testCompile "junit:junit:$junit_version"

64
client/rpc/build.gradle Normal file
View File

@ -0,0 +1,64 @@
apply plugin: 'kotlin'
apply plugin: 'net.corda.plugins.quasar-utils'
apply plugin: 'net.corda.plugins.publish-utils'
description 'Corda client RPC modules'
repositories {
mavenLocal()
mavenCentral()
maven {
url 'http://oss.sonatype.org/content/repositories/snapshots'
}
jcenter()
maven {
url 'https://dl.bintray.com/kotlin/exposed'
}
}
//noinspection GroovyAssignabilityCheck
configurations {
// we don't want isolated.jar in classPath, since we want to test jar being dynamically loaded as an attachment
runtime.exclude module: 'isolated'
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
}
sourceSets {
integrationTest {
kotlin {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integration-test/kotlin')
}
}
test {
resources {
srcDir "../../config/test"
}
}
}
// 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.
dependencies {
compile project(':core')
compile project(':node-api')
// Unit testing helpers.
testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
testCompile "junit:junit:$junit_version"
testCompile "org.assertj:assertj-core:${assertj_version}"
testCompile project(':test-utils')
// Integration test helpers
integrationTestCompile "junit:junit:$junit_version"
}
task integrationTest(type: Test) {
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
}

View File

@ -1,4 +1,4 @@
package net.corda.node.services.messaging package net.corda.client.rpc
import com.google.common.net.HostAndPort import com.google.common.net.HostAndPort
import net.corda.nodeapi.config.SSLConfiguration import net.corda.nodeapi.config.SSLConfiguration
@ -8,8 +8,11 @@ import net.corda.core.messaging.CordaRPCOps
import net.corda.core.minutes import net.corda.core.minutes
import net.corda.core.seconds import net.corda.core.seconds
import net.corda.core.utilities.loggerFor import net.corda.core.utilities.loggerFor
import net.corda.nodeapi.ArtemisMessagingComponent
import net.corda.nodeapi.ArtemisTcpTransport.Companion.tcpTransport import net.corda.nodeapi.ArtemisTcpTransport.Companion.tcpTransport
import net.corda.nodeapi.ConnectionDirection import net.corda.nodeapi.ConnectionDirection
import net.corda.nodeapi.RPCException
import net.corda.nodeapi.rpcLog
import org.apache.activemq.artemis.api.core.ActiveMQException import org.apache.activemq.artemis.api.core.ActiveMQException
import org.apache.activemq.artemis.api.core.client.ActiveMQClient import org.apache.activemq.artemis.api.core.client.ActiveMQClient
import org.apache.activemq.artemis.api.core.client.ClientSession import org.apache.activemq.artemis.api.core.client.ClientSession

View File

@ -1,10 +1,11 @@
package net.corda.node.services.messaging package net.corda.client.rpc
import com.esotericsoftware.kryo.Kryo import com.esotericsoftware.kryo.Kryo
import com.esotericsoftware.kryo.KryoException import com.esotericsoftware.kryo.KryoException
import com.esotericsoftware.kryo.Serializer import com.esotericsoftware.kryo.Serializer
import com.esotericsoftware.kryo.io.Input import com.esotericsoftware.kryo.io.Input
import com.esotericsoftware.kryo.io.Output import com.esotericsoftware.kryo.io.Output
import com.esotericsoftware.kryo.pool.KryoPool
import com.google.common.cache.CacheBuilder import com.google.common.cache.CacheBuilder
import net.corda.core.ErrorOr import net.corda.core.ErrorOr
import net.corda.core.bufferUntilSubscribed import net.corda.core.bufferUntilSubscribed
@ -14,6 +15,7 @@ import net.corda.core.random63BitValue
import net.corda.core.serialization.deserialize import net.corda.core.serialization.deserialize
import net.corda.core.serialization.serialize import net.corda.core.serialization.serialize
import net.corda.core.utilities.debug import net.corda.core.utilities.debug
import net.corda.nodeapi.*
import org.apache.activemq.artemis.api.core.ActiveMQObjectClosedException import org.apache.activemq.artemis.api.core.ActiveMQObjectClosedException
import org.apache.activemq.artemis.api.core.Message.HDR_DUPLICATE_DETECTION_ID import org.apache.activemq.artemis.api.core.Message.HDR_DUPLICATE_DETECTION_ID
import org.apache.activemq.artemis.api.core.SimpleString import org.apache.activemq.artemis.api.core.SimpleString
@ -383,3 +385,18 @@ class CordaRPCClientImpl(private val session: ClientSession,
} }
//endregion //endregion
} }
private val rpcDesKryoPool = KryoPool.Builder { RPCKryo(CordaRPCClientImpl.ObservableDeserializer()) }.build()
fun createRPCKryoForDeserialization(rpcClient: CordaRPCClientImpl, qName: String? = null, rpcName: String? = null, rpcLocation: Throwable? = null): Kryo {
val kryo = rpcDesKryoPool.borrow()
kryo.context.put(RPCKryoClientKey, rpcClient)
kryo.context.put(RPCKryoQNameKey, qName)
kryo.context.put(RPCKryoMethodNameKey, rpcName)
kryo.context.put(RPCKryoLocationKey, rpcLocation)
return kryo
}
fun releaseRPCKryoForDeserialization(kryo: Kryo) {
rpcDesKryoPool.release(kryo)
}

View File

@ -1,4 +1,4 @@
package net.corda.node.messaging package net.corda.client.rpc
import net.corda.core.messaging.RPCOps import net.corda.core.messaging.RPCOps
import net.corda.core.serialization.SerializedBytes import net.corda.core.serialization.SerializedBytes
@ -6,7 +6,6 @@ import net.corda.core.utilities.LogHelper
import net.corda.node.services.RPCUserService import net.corda.node.services.RPCUserService
import net.corda.node.services.User import net.corda.node.services.User
import net.corda.node.services.messaging.ArtemisMessagingComponent import net.corda.node.services.messaging.ArtemisMessagingComponent
import net.corda.node.services.messaging.CordaRPCClientImpl
import net.corda.node.services.messaging.RPCDispatcher import net.corda.node.services.messaging.RPCDispatcher
import net.corda.node.utilities.AffinityExecutor import net.corda.node.utilities.AffinityExecutor
import org.apache.activemq.artemis.api.core.Message import org.apache.activemq.artemis.api.core.Message

View File

@ -1,4 +1,4 @@
package net.corda.node.messaging package net.corda.client.rpc
import com.google.common.util.concurrent.Futures import com.google.common.util.concurrent.Futures
import com.google.common.util.concurrent.ListenableFuture import com.google.common.util.concurrent.ListenableFuture

View File

@ -1,4 +1,4 @@
package net.corda.node.messaging package net.corda.client.rpc
import net.corda.core.messaging.RPCOps import net.corda.core.messaging.RPCOps
import net.corda.node.services.User import net.corda.node.services.User

View File

@ -33,7 +33,7 @@ sourceSets {
dependencies { dependencies {
testCompile "junit:junit:$junit_version" testCompile "junit:junit:$junit_version"
testCompile "commons-fileupload:commons-fileupload:1.3.2" testCompile "commons-fileupload:commons-fileupload:$fileupload_version"
// Guava: Google test library (collections test suite) // Guava: Google test library (collections test suite)
testCompile "com.google.guava:guava-testlib:$guava_version" testCompile "com.google.guava:guava-testlib:$guava_version"
@ -45,7 +45,7 @@ dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
compile "org.jetbrains.kotlinx:kotlinx-support-jdk8:0.3" compile "org.jetbrains.kotlinx:kotlinx-support-jdk8:0.3"
compile "org.jetbrains.kotlin:kotlin-test:$kotlin_version" testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
// Thread safety annotations // Thread safety annotations
compile "com.google.code.findbugs:jsr305:3.0.1" compile "com.google.code.findbugs:jsr305:3.0.1"

View File

@ -31,6 +31,7 @@ sealed class ServiceType(val id: String) {
val notary: ServiceType = corda.getSubType("notary") val notary: ServiceType = corda.getSubType("notary")
val regulator: ServiceType = corda.getSubType("regulator") val regulator: ServiceType = corda.getSubType("regulator")
val networkMap: ServiceType = corda.getSubType("network_map")
fun getServiceType(namespace: String, typeId: String): ServiceType { fun getServiceType(namespace: String, typeId: String): ServiceType {
require(!namespace.startsWith("corda")) { "Corda namespace is protected" } require(!namespace.startsWith("corda")) { "Corda namespace is protected" }
@ -47,7 +48,8 @@ sealed class ServiceType(val id: String) {
fun isSubTypeOf(superType: ServiceType) = (id == superType.id) || id.startsWith(superType.id + ".") fun isSubTypeOf(superType: ServiceType) = (id == superType.id) || id.startsWith(superType.id + ".")
fun isNotary() = isSubTypeOf(notary) fun isNotary() = isSubTypeOf(notary)
fun isValidatingNotary() = isNotary() && id.contains(".validating") fun isValidatingNotary() = isNotary() && id.contains(".validating")
fun isNetworkMap() = id == networkMap.id
override fun hashCode(): Int = id.hashCode() override fun hashCode(): Int = id.hashCode()
override fun toString(): String = id.toString() override fun toString(): String = id
} }

View File

@ -14,10 +14,10 @@ import net.corda.flows.CashIssueFlow
import net.corda.flows.ContractUpgradeFlow import net.corda.flows.ContractUpgradeFlow
import net.corda.flows.FinalityFlow import net.corda.flows.FinalityFlow
import net.corda.node.internal.CordaRPCOpsImpl import net.corda.node.internal.CordaRPCOpsImpl
import net.corda.node.services.User
import net.corda.node.services.messaging.CURRENT_RPC_USER
import net.corda.node.services.startFlowPermission import net.corda.node.services.startFlowPermission
import net.corda.node.utilities.databaseTransaction import net.corda.node.utilities.databaseTransaction
import net.corda.nodeapi.CURRENT_RPC_USER
import net.corda.nodeapi.User
import net.corda.testing.node.MockNetwork import net.corda.testing.node.MockNetwork
import org.junit.After import org.junit.After
import org.junit.Before import org.junit.Before

View File

@ -41,6 +41,7 @@ compileTestJava.dependsOn tasks.getByPath(':node:capsule:buildCordaJAR')
dependencies { dependencies {
compile project(':core') compile project(':core')
compile project(':client:jfx') compile project(':client:jfx')
compile project(':node')
testCompile project(':test-utils') testCompile project(':test-utils')
compile "org.graphstream:gs-core:1.3" compile "org.graphstream:gs-core:1.3"

View File

@ -12,9 +12,9 @@ import net.corda.core.serialization.OpaqueBytes
import net.corda.flows.CashIssueFlow import net.corda.flows.CashIssueFlow
import net.corda.flows.CashPaymentFlow import net.corda.flows.CashPaymentFlow
import net.corda.node.driver.driver import net.corda.node.driver.driver
import net.corda.node.services.User
import net.corda.node.services.startFlowPermission import net.corda.node.services.startFlowPermission
import net.corda.node.services.transactions.ValidatingNotaryService import net.corda.node.services.transactions.ValidatingNotaryService
import net.corda.nodeapi.User
import net.corda.testing.expect import net.corda.testing.expect
import net.corda.testing.expectEvents import net.corda.testing.expectEvents
import net.corda.testing.parallel import net.corda.testing.parallel

View File

@ -17,9 +17,9 @@ import net.corda.flows.CashExitFlow
import net.corda.flows.CashIssueFlow import net.corda.flows.CashIssueFlow
import net.corda.flows.CashPaymentFlow import net.corda.flows.CashPaymentFlow
import net.corda.node.driver.driver import net.corda.node.driver.driver
import net.corda.node.services.User
import net.corda.node.services.startFlowPermission import net.corda.node.services.startFlowPermission
import net.corda.node.services.transactions.ValidatingNotaryService import net.corda.node.services.transactions.ValidatingNotaryService
import net.corda.nodeapi.User
import org.graphstream.graph.Edge import org.graphstream.graph.Edge
import org.graphstream.graph.Node import org.graphstream.graph.Node
import org.graphstream.graph.implementations.MultiGraph import org.graphstream.graph.implementations.MultiGraph

View File

@ -41,10 +41,14 @@ dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
compile "org.jetbrains.kotlinx:kotlinx-support-jdk8:0.3" compile "org.jetbrains.kotlinx:kotlinx-support-jdk8:0.3"
compile "org.jetbrains.kotlin:kotlin-test:$kotlin_version" testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
compile "org.apache.activemq:artemis-core-client:${artemis_version}" compile "org.apache.activemq:artemis-core-client:${artemis_version}"
compile "org.apache.activemq:artemis-commons:${artemis_version}" compile "org.apache.activemq:artemis-commons:${artemis_version}"
// For adding serialisation of file upload streams to RPC
// TODO: Remove this dependency and the code that requires it
compile "commons-fileupload:commons-fileupload:$fileupload_version"
// TypeSafe Config: for simple and human friendly config files. // TypeSafe Config: for simple and human friendly config files.
compile "com.typesafe:config:$typesafe_config_version" compile "com.typesafe:config:$typesafe_config_version"
} }

View File

@ -1,4 +1,4 @@
package net.corda.node.services.messaging package net.corda.nodeapi
import com.google.common.annotations.VisibleForTesting import com.google.common.annotations.VisibleForTesting
import com.google.common.net.HostAndPort import com.google.common.net.HostAndPort

View File

@ -1,20 +1,17 @@
@file:JvmName("RPCStructures") @file:JvmName("RPCStructures")
package net.corda.node.services.messaging package net.corda.nodeapi
import com.esotericsoftware.kryo.Kryo import com.esotericsoftware.kryo.Kryo
import com.esotericsoftware.kryo.Registration import com.esotericsoftware.kryo.Registration
import com.esotericsoftware.kryo.Serializer import com.esotericsoftware.kryo.Serializer
import com.esotericsoftware.kryo.io.Input import com.esotericsoftware.kryo.io.Input
import com.esotericsoftware.kryo.io.Output import com.esotericsoftware.kryo.io.Output
import com.esotericsoftware.kryo.pool.KryoPool
import com.google.common.util.concurrent.ListenableFuture import com.google.common.util.concurrent.ListenableFuture
import net.corda.core.flows.FlowException import net.corda.core.flows.FlowException
import net.corda.core.serialization.* import net.corda.core.serialization.*
import net.corda.core.toFuture import net.corda.core.toFuture
import net.corda.core.toObservable import net.corda.core.toObservable
import net.corda.node.services.User
import net.corda.node.services.messaging.ArtemisMessagingComponent.Companion.NODE_USER
import org.apache.commons.fileupload.MultipartStream import org.apache.commons.fileupload.MultipartStream
import org.slf4j.Logger import org.slf4j.Logger
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
@ -27,6 +24,10 @@ val rpcLog: Logger by lazy { LoggerFactory.getLogger("net.corda.rpc") }
/** Used in the RPC wire protocol to wrap an observation with the handle of the observable it's intended for. */ /** Used in the RPC wire protocol to wrap an observation with the handle of the observable it's intended for. */
data class MarshalledObservation(val forHandle: Int, val what: Notification<*>) data class MarshalledObservation(val forHandle: Int, val what: Notification<*>)
data class User(val username: String, val password: String, val permissions: Set<String>) {
override fun toString(): String = "${javaClass.simpleName}($username, permissions=$permissions)"
}
/** Records the protocol version in which this RPC was added. */ /** Records the protocol version in which this RPC was added. */
@Target(AnnotationTarget.FUNCTION) @Target(AnnotationTarget.FUNCTION)
@MustBeDocumented @MustBeDocumented
@ -54,16 +55,6 @@ data class ClientRPCRequestMessage(
@JvmField @JvmField
val CURRENT_RPC_USER: ThreadLocal<User> = ThreadLocal() val CURRENT_RPC_USER: ThreadLocal<User> = ThreadLocal()
/** Helper method which checks that the current RPC user is entitled for the given permission. Throws a [PermissionException] otherwise. */
fun requirePermission(permission: String) {
// TODO remove the NODE_USER condition once webserver doesn't need it
val currentUser = CURRENT_RPC_USER.get()
val currentUserPermissions = currentUser.permissions
if (currentUser.username != NODE_USER && currentUserPermissions.intersect(listOf(permission, "ALL")).isEmpty()) {
throw PermissionException("User not permissioned for $permission, permissions are $currentUserPermissions")
}
}
/** /**
* Thrown to indicate a fatal error in the RPC system itself, as opposed to an error generated by the invoked * Thrown to indicate a fatal error in the RPC system itself, as opposed to an error generated by the invoked
* method. * method.
@ -98,7 +89,7 @@ object RPCKryoLocationKey
// The Kryo used for the RPC wire protocol. Every type in the wire protocol is listed here explicitly. // The Kryo used for the RPC wire protocol. Every type in the wire protocol is listed here explicitly.
// This is annoying to write out, but will make it easier to formalise the wire protocol when the time comes, // This is annoying to write out, but will make it easier to formalise the wire protocol when the time comes,
// because we can see everything we're using in one place. // because we can see everything we're using in one place.
private class RPCKryo(observableSerializer: Serializer<Observable<Any>>) : CordaKryo(makeStandardClassResolver()) { class RPCKryo(observableSerializer: Serializer<Observable<Any>>) : CordaKryo(makeStandardClassResolver()) {
init { init {
DefaultKryoCustomizer.customize(this) DefaultKryoCustomizer.customize(this)
@ -143,31 +134,3 @@ private class RPCKryo(observableSerializer: Serializer<Observable<Any>>) : Corda
return super.getRegistration(type) return super.getRegistration(type)
} }
} }
private val rpcSerKryoPool = KryoPool.Builder { RPCKryo(RPCDispatcher.ObservableSerializer()) }.build()
fun createRPCKryoForSerialization(qName: String? = null, dispatcher: RPCDispatcher? = null): Kryo {
val kryo = rpcSerKryoPool.borrow()
kryo.context.put(RPCKryoQNameKey, qName)
kryo.context.put(RPCKryoDispatcherKey, dispatcher)
return kryo
}
fun releaseRPCKryoForSerialization(kryo: Kryo) {
rpcSerKryoPool.release(kryo)
}
private val rpcDesKryoPool = KryoPool.Builder { RPCKryo(CordaRPCClientImpl.ObservableDeserializer()) }.build()
fun createRPCKryoForDeserialization(rpcClient: CordaRPCClientImpl, qName: String? = null, rpcName: String? = null, rpcLocation: Throwable? = null): Kryo {
val kryo = rpcDesKryoPool.borrow()
kryo.context.put(RPCKryoClientKey, rpcClient)
kryo.context.put(RPCKryoQNameKey, qName)
kryo.context.put(RPCKryoMethodNameKey, rpcName)
kryo.context.put(RPCKryoLocationKey, rpcLocation)
return kryo
}
fun releaseRPCKryoForDeserialization(kryo: Kryo) {
rpcDesKryoPool.release(kryo)
}

View File

@ -1,4 +1,4 @@
package net.corda.node.serialization package net.corda.nodeapi.serialization
import com.esotericsoftware.kryo.KryoException import com.esotericsoftware.kryo.KryoException
import com.google.common.net.HostAndPort import com.google.common.net.HostAndPort

View File

@ -0,0 +1,2 @@
# Register a ServiceLoader service extending from net.corda.core.node.CordaPluginRegistry
net.corda.nodeapi.serialization.DefaultWhitelist

View File

@ -43,6 +43,7 @@ sourceSets {
dependencies { dependencies {
compile project(':core') compile project(':core')
testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
// Requery: SQL based query & persistence for Kotlin // Requery: SQL based query & persistence for Kotlin
kapt "io.requery:requery-processor:$requery_version" kapt "io.requery:requery-processor:$requery_version"

View File

@ -69,6 +69,7 @@ dependencies {
exclude group: 'javassist', module: 'javassist' exclude group: 'javassist', module: 'javassist'
} }
compile project(':node-api') compile project(':node-api')
compile project(':client:rpc')
compile "com.google.code.findbugs:jsr305:3.0.1" compile "com.google.code.findbugs:jsr305:3.0.1"
@ -78,7 +79,7 @@ dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-test:$kotlin_version" testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
compile "com.google.guava:guava:$guava_version" compile "com.google.guava:guava:$guava_version"
@ -105,10 +106,6 @@ dependencies {
exclude group: "asm" exclude group: "asm"
} }
// For adding serialisation of file upload streams to RPC
// TODO: Remove this dependency and the code that requires it
compile "commons-fileupload:commons-fileupload:1.3.2"
compile "com.fasterxml.jackson.core:jackson-annotations:${jackson_version}" compile "com.fasterxml.jackson.core:jackson-annotations:${jackson_version}"
// Coda Hale's Metrics: for monitoring of key statistics // Coda Hale's Metrics: for monitoring of key statistics

View File

@ -8,9 +8,9 @@ import net.corda.core.node.services.ServiceInfo
import net.corda.core.readLines import net.corda.core.readLines
import net.corda.node.LOGS_DIRECTORY_NAME import net.corda.node.LOGS_DIRECTORY_NAME
import net.corda.node.services.api.RegulatorService import net.corda.node.services.api.RegulatorService
import net.corda.node.services.messaging.ArtemisMessagingComponent
import net.corda.node.services.transactions.SimpleNotaryService import net.corda.node.services.transactions.SimpleNotaryService
import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThat
import net.corda.nodeapi.ArtemisMessagingComponent
import org.junit.Test import org.junit.Test
import java.nio.file.Paths import java.nio.file.Paths
import java.util.concurrent.Executors import java.util.concurrent.Executors

View File

@ -16,6 +16,7 @@ import net.corda.flows.CashPaymentFlow
import net.corda.node.driver.NodeHandle import net.corda.node.driver.NodeHandle
import net.corda.node.driver.driver import net.corda.node.driver.driver
import net.corda.node.services.transactions.RaftValidatingNotaryService import net.corda.node.services.transactions.RaftValidatingNotaryService
import net.corda.nodeapi.User
import net.corda.testing.expect import net.corda.testing.expect
import net.corda.testing.expectEvents import net.corda.testing.expectEvents
import net.corda.testing.node.DriverBasedTest import net.corda.testing.node.DriverBasedTest

View File

@ -1,8 +1,8 @@
package net.corda.services.messaging package net.corda.services.messaging
import net.corda.node.services.messaging.ArtemisMessagingComponent.Companion.NODE_USER import net.corda.nodeapi.ArtemisMessagingComponent.Companion.NODE_USER
import net.corda.node.services.messaging.ArtemisMessagingComponent.Companion.PEER_USER import net.corda.nodeapi.ArtemisMessagingComponent.Companion.PEER_USER
import net.corda.node.services.messaging.ArtemisMessagingComponent.Companion.RPC_REQUESTS_QUEUE import net.corda.nodeapi.ArtemisMessagingComponent.Companion.RPC_REQUESTS_QUEUE
import net.corda.testing.messaging.SimpleMQClient import net.corda.testing.messaging.SimpleMQClient
import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration
import org.apache.activemq.artemis.api.core.ActiveMQClusterSecurityException import org.apache.activemq.artemis.api.core.ActiveMQClusterSecurityException

View File

@ -1,6 +1,6 @@
package net.corda.services.messaging package net.corda.services.messaging
import net.corda.node.services.User import net.corda.nodeapi.User
import net.corda.testing.messaging.SimpleMQClient import net.corda.testing.messaging.SimpleMQClient
import org.apache.activemq.artemis.api.core.ActiveMQSecurityException import org.apache.activemq.artemis.api.core.ActiveMQSecurityException
import org.assertj.core.api.Assertions.assertThatExceptionOfType import org.assertj.core.api.Assertions.assertThatExceptionOfType

View File

@ -2,6 +2,7 @@ package net.corda.services.messaging
import co.paralleluniverse.fibers.Suspendable import co.paralleluniverse.fibers.Suspendable
import com.google.common.net.HostAndPort import com.google.common.net.HostAndPort
import net.corda.client.rpc.CordaRPCClientImpl
import net.corda.nodeapi.config.SSLConfiguration import net.corda.nodeapi.config.SSLConfiguration
import net.corda.core.crypto.Party import net.corda.core.crypto.Party
import net.corda.core.crypto.composite import net.corda.core.crypto.composite
@ -13,16 +14,15 @@ import net.corda.core.random63BitValue
import net.corda.core.seconds import net.corda.core.seconds
import net.corda.core.utilities.unwrap import net.corda.core.utilities.unwrap
import net.corda.node.internal.Node import net.corda.node.internal.Node
import net.corda.node.services.User import net.corda.nodeapi.ArtemisMessagingComponent.Companion.CLIENTS_PREFIX
import net.corda.node.services.messaging.ArtemisMessagingComponent.Companion.CLIENTS_PREFIX import net.corda.nodeapi.ArtemisMessagingComponent.Companion.INTERNAL_PREFIX
import net.corda.node.services.messaging.ArtemisMessagingComponent.Companion.INTERNAL_PREFIX import net.corda.nodeapi.ArtemisMessagingComponent.Companion.NETWORK_MAP_QUEUE
import net.corda.node.services.messaging.ArtemisMessagingComponent.Companion.NETWORK_MAP_QUEUE import net.corda.nodeapi.ArtemisMessagingComponent.Companion.NOTIFICATIONS_ADDRESS
import net.corda.node.services.messaging.ArtemisMessagingComponent.Companion.NOTIFICATIONS_ADDRESS import net.corda.nodeapi.ArtemisMessagingComponent.Companion.P2P_QUEUE
import net.corda.node.services.messaging.ArtemisMessagingComponent.Companion.P2P_QUEUE import net.corda.nodeapi.ArtemisMessagingComponent.Companion.PEERS_PREFIX
import net.corda.node.services.messaging.ArtemisMessagingComponent.Companion.PEERS_PREFIX import net.corda.nodeapi.ArtemisMessagingComponent.Companion.RPC_QUEUE_REMOVALS_QUEUE
import net.corda.node.services.messaging.ArtemisMessagingComponent.Companion.RPC_QUEUE_REMOVALS_QUEUE import net.corda.nodeapi.ArtemisMessagingComponent.Companion.RPC_REQUESTS_QUEUE
import net.corda.node.services.messaging.ArtemisMessagingComponent.Companion.RPC_REQUESTS_QUEUE import net.corda.nodeapi.User
import net.corda.node.services.messaging.CordaRPCClientImpl
import net.corda.testing.configureTestSSL import net.corda.testing.configureTestSSL
import net.corda.testing.messaging.SimpleMQClient import net.corda.testing.messaging.SimpleMQClient
import net.corda.testing.node.NodeBasedTest import net.corda.testing.node.NodeBasedTest

View File

@ -172,7 +172,7 @@ private fun printPluginsAndServices(node: Node) {
} }
val plugins = node.pluginRegistries val plugins = node.pluginRegistries
.map { it.javaClass.name } .map { it.javaClass.name }
.filterNot { it.startsWith("net.corda.node.") || it.startsWith("net.corda.core.") } .filterNot { it.startsWith("net.corda.node.") || it.startsWith("net.corda.core.") || it.startsWith("net.corda.nodeapi.")}
.map { it.substringBefore('$') } .map { it.substringBefore('$') }
if (plugins.isNotEmpty()) if (plugins.isNotEmpty())
printBasicNodeInfo("Loaded plugins", plugins.joinToString()) printBasicNodeInfo("Loaded plugins", plugins.joinToString())

View File

@ -6,6 +6,7 @@ import com.google.common.util.concurrent.*
import com.typesafe.config.Config import com.typesafe.config.Config
import com.typesafe.config.ConfigRenderOptions import com.typesafe.config.ConfigRenderOptions
import net.corda.core.ThreadBox import net.corda.core.ThreadBox
import net.corda.client.rpc.CordaRPCClient
import net.corda.core.crypto.Party import net.corda.core.crypto.Party
import net.corda.core.div import net.corda.core.div
import net.corda.core.flatMap import net.corda.core.flatMap
@ -16,15 +17,14 @@ import net.corda.core.node.services.ServiceInfo
import net.corda.core.node.services.ServiceType import net.corda.core.node.services.ServiceType
import net.corda.core.utilities.loggerFor import net.corda.core.utilities.loggerFor
import net.corda.node.LOGS_DIRECTORY_NAME import net.corda.node.LOGS_DIRECTORY_NAME
import net.corda.node.services.User
import net.corda.node.services.config.ConfigHelper import net.corda.node.services.config.ConfigHelper
import net.corda.node.services.config.FullNodeConfiguration import net.corda.node.services.config.FullNodeConfiguration
import net.corda.node.services.messaging.ArtemisMessagingComponent
import net.corda.node.services.messaging.CordaRPCClient
import net.corda.node.services.messaging.NodeMessagingClient import net.corda.node.services.messaging.NodeMessagingClient
import net.corda.node.services.network.NetworkMapService import net.corda.node.services.network.NetworkMapService
import net.corda.node.services.transactions.RaftValidatingNotaryService import net.corda.node.services.transactions.RaftValidatingNotaryService
import net.corda.node.utilities.ServiceIdentityGenerator import net.corda.node.utilities.ServiceIdentityGenerator
import net.corda.nodeapi.ArtemisMessagingComponent
import net.corda.nodeapi.User
import net.corda.nodeapi.config.SSLConfiguration import net.corda.nodeapi.config.SSLConfiguration
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.Request import okhttp3.Request

View File

@ -20,15 +20,14 @@ import net.corda.node.services.RPCUserService
import net.corda.node.services.RPCUserServiceImpl import net.corda.node.services.RPCUserServiceImpl
import net.corda.node.services.api.MessagingServiceInternal import net.corda.node.services.api.MessagingServiceInternal
import net.corda.node.services.config.FullNodeConfiguration import net.corda.node.services.config.FullNodeConfiguration
import net.corda.node.services.messaging.ArtemisMessagingComponent.NetworkMapAddress
import net.corda.node.services.messaging.ArtemisMessagingServer import net.corda.node.services.messaging.ArtemisMessagingServer
import net.corda.node.services.messaging.NodeMessagingClient import net.corda.node.services.messaging.NodeMessagingClient
import net.corda.node.services.transactions.PersistentUniquenessProvider import net.corda.node.services.transactions.PersistentUniquenessProvider
import net.corda.node.services.transactions.RaftUniquenessProvider import net.corda.node.services.transactions.RaftUniquenessProvider
import net.corda.node.services.transactions.RaftValidatingNotaryService import net.corda.node.services.transactions.RaftValidatingNotaryService
import net.corda.node.utilities.AddressUtils import net.corda.node.utilities.AddressUtils
import net.corda.node.services.transactions.*
import net.corda.node.utilities.AffinityExecutor import net.corda.node.utilities.AffinityExecutor
import net.corda.nodeapi.ArtemisMessagingComponent.NetworkMapAddress
import org.slf4j.Logger import org.slf4j.Logger
import java.io.RandomAccessFile import java.io.RandomAccessFile
import java.lang.management.ManagementFactory import java.lang.management.ManagementFactory

View File

@ -2,6 +2,7 @@ package net.corda.node.services
import net.corda.core.flows.FlowLogic import net.corda.core.flows.FlowLogic
import net.corda.node.services.config.NodeConfiguration import net.corda.node.services.config.NodeConfiguration
import net.corda.nodeapi.User
/** /**
* Service for retrieving [User] objects representing RPC users who are authorised to use the RPC system. A [User] * Service for retrieving [User] objects representing RPC users who are authorised to use the RPC system. A [User]
@ -24,10 +25,6 @@ class RPCUserServiceImpl(config: NodeConfiguration) : RPCUserService {
override val users: List<User> get() = _users.values.toList() override val users: List<User> get() = _users.values.toList()
} }
data class User(val username: String, val password: String, val permissions: Set<String>) {
override fun toString(): String = "${javaClass.simpleName}($username, permissions=$permissions)"
}
fun startFlowPermission(className: String) = "StartFlow.$className" fun startFlowPermission(className: String) = "StartFlow.$className"
fun <P : FlowLogic<*>> startFlowPermission(clazz: Class<P>) = startFlowPermission(clazz.name) fun <P : FlowLogic<*>> startFlowPermission(clazz: Class<P>) = startFlowPermission(clazz.name)
inline fun <reified P : FlowLogic<*>> startFlowPermission(): String = startFlowPermission(P::class.java) inline fun <reified P : FlowLogic<*>> startFlowPermission(): String = startFlowPermission(P::class.java)

View File

@ -12,9 +12,9 @@ import net.corda.core.node.services.ServiceInfo
import net.corda.node.internal.NetworkMapInfo import net.corda.node.internal.NetworkMapInfo
import net.corda.node.internal.Node import net.corda.node.internal.Node
import net.corda.node.serialization.NodeClock import net.corda.node.serialization.NodeClock
import net.corda.node.services.User
import net.corda.node.services.network.NetworkMapService import net.corda.node.services.network.NetworkMapService
import net.corda.node.utilities.TestClock import net.corda.node.utilities.TestClock
import net.corda.nodeapi.User
import java.net.URL import java.net.URL
import java.nio.file.Path import java.nio.file.Path
import java.util.* import java.util.*

View File

@ -16,18 +16,19 @@ import net.corda.core.node.services.NetworkMapCache.MapChange
import net.corda.core.seconds import net.corda.core.seconds
import net.corda.core.utilities.debug import net.corda.core.utilities.debug
import net.corda.core.utilities.loggerFor import net.corda.core.utilities.loggerFor
import net.corda.nodeapi.ArtemisTcpTransport
import net.corda.nodeapi.ConnectionDirection
import net.corda.nodeapi.expectedOnDefaultFileSystem
import net.corda.node.printBasicNodeInfo import net.corda.node.printBasicNodeInfo
import net.corda.node.services.RPCUserService import net.corda.node.services.RPCUserService
import net.corda.node.services.config.NodeConfiguration import net.corda.node.services.config.NodeConfiguration
import net.corda.node.services.messaging.ArtemisMessagingComponent.Companion.CLIENTS_PREFIX
import net.corda.node.services.messaging.ArtemisMessagingComponent.Companion.NODE_USER
import net.corda.node.services.messaging.ArtemisMessagingComponent.Companion.PEER_USER
import net.corda.node.services.messaging.NodeLoginModule.Companion.NODE_ROLE import net.corda.node.services.messaging.NodeLoginModule.Companion.NODE_ROLE
import net.corda.node.services.messaging.NodeLoginModule.Companion.PEER_ROLE import net.corda.node.services.messaging.NodeLoginModule.Companion.PEER_ROLE
import net.corda.node.services.messaging.NodeLoginModule.Companion.RPC_ROLE import net.corda.node.services.messaging.NodeLoginModule.Companion.RPC_ROLE
import net.corda.nodeapi.ArtemisMessagingComponent.Companion.CLIENTS_PREFIX
import net.corda.nodeapi.ArtemisMessagingComponent.Companion.NODE_USER
import net.corda.nodeapi.ArtemisMessagingComponent.Companion.PEER_USER
import net.corda.nodeapi.ArtemisMessagingComponent
import net.corda.nodeapi.ArtemisTcpTransport
import net.corda.nodeapi.ConnectionDirection
import net.corda.nodeapi.expectedOnDefaultFileSystem
import org.apache.activemq.artemis.api.core.SimpleString import org.apache.activemq.artemis.api.core.SimpleString
import org.apache.activemq.artemis.core.config.BridgeConfiguration import org.apache.activemq.artemis.core.config.BridgeConfiguration
import org.apache.activemq.artemis.core.config.Configuration import org.apache.activemq.artemis.core.config.Configuration

View File

@ -19,6 +19,7 @@ import net.corda.node.services.api.MessagingServiceInternal
import net.corda.node.services.config.NodeConfiguration import net.corda.node.services.config.NodeConfiguration
import net.corda.node.services.statemachine.StateMachineManager import net.corda.node.services.statemachine.StateMachineManager
import net.corda.node.utilities.* import net.corda.node.utilities.*
import net.corda.nodeapi.ArtemisMessagingComponent
import org.apache.activemq.artemis.api.core.ActiveMQObjectClosedException import org.apache.activemq.artemis.api.core.ActiveMQObjectClosedException
import org.apache.activemq.artemis.api.core.Message.* import org.apache.activemq.artemis.api.core.Message.*
import org.apache.activemq.artemis.api.core.SimpleString import org.apache.activemq.artemis.api.core.SimpleString

View File

@ -5,6 +5,7 @@ import com.esotericsoftware.kryo.KryoException
import com.esotericsoftware.kryo.Serializer import com.esotericsoftware.kryo.Serializer
import com.esotericsoftware.kryo.io.Input import com.esotericsoftware.kryo.io.Input
import com.esotericsoftware.kryo.io.Output import com.esotericsoftware.kryo.io.Output
import com.esotericsoftware.kryo.pool.KryoPool
import com.google.common.annotations.VisibleForTesting import com.google.common.annotations.VisibleForTesting
import com.google.common.collect.HashMultimap import com.google.common.collect.HashMultimap
import net.corda.core.ErrorOr import net.corda.core.ErrorOr
@ -14,11 +15,11 @@ import net.corda.core.messaging.RPCReturnsObservables
import net.corda.core.serialization.SerializedBytes import net.corda.core.serialization.SerializedBytes
import net.corda.core.serialization.deserialize import net.corda.core.serialization.deserialize
import net.corda.core.serialization.serialize import net.corda.core.serialization.serialize
import net.corda.core.utilities.debug
import net.corda.node.services.RPCUserService import net.corda.node.services.RPCUserService
import net.corda.node.services.User
import net.corda.node.services.messaging.ArtemisMessagingComponent.Companion.NODE_USER
import net.corda.node.utilities.AffinityExecutor import net.corda.node.utilities.AffinityExecutor
import net.corda.core.utilities.debug
import net.corda.nodeapi.*
import net.corda.nodeapi.ArtemisMessagingComponent.Companion.NODE_USER
import org.apache.activemq.artemis.api.core.Message import org.apache.activemq.artemis.api.core.Message
import org.apache.activemq.artemis.api.core.client.ClientConsumer import org.apache.activemq.artemis.api.core.client.ClientConsumer
import org.apache.activemq.artemis.api.core.client.ClientMessage import org.apache.activemq.artemis.api.core.client.ClientMessage
@ -193,3 +194,16 @@ abstract class RPCDispatcher(val ops: RPCOps, val userService: RPCUserService, v
} }
} }
} }
private val rpcSerKryoPool = KryoPool.Builder { RPCKryo(RPCDispatcher.ObservableSerializer()) }.build()
fun createRPCKryoForSerialization(qName: String? = null, dispatcher: RPCDispatcher? = null): Kryo {
val kryo = rpcSerKryoPool.borrow()
kryo.context.put(RPCKryoQNameKey, qName)
kryo.context.put(RPCKryoDispatcherKey, dispatcher)
return kryo
}
fun releaseRPCKryoForSerialization(kryo: Kryo) {
rpcSerKryoPool.release(kryo)
}

View File

@ -0,0 +1,17 @@
@file:JvmName("RPCServerStructures")
package net.corda.node.services.messaging
import net.corda.nodeapi.ArtemisMessagingComponent
import net.corda.nodeapi.CURRENT_RPC_USER
import net.corda.nodeapi.PermissionException
/** Helper method which checks that the current RPC user is entitled for the given permission. Throws a [PermissionException] otherwise. */
fun requirePermission(permission: String) {
// TODO remove the NODE_USER condition once webserver doesn't need it
val currentUser = CURRENT_RPC_USER.get()
val currentUserPermissions = currentUser.permissions
if (currentUser.username != ArtemisMessagingComponent.NODE_USER && currentUserPermissions.intersect(listOf(permission, "ALL")).isEmpty()) {
throw PermissionException("User not permissioned for $permission, permissions are $currentUserPermissions")
}
}

View File

@ -72,7 +72,7 @@ interface NetworkMapService {
// Base topic for messages acknowledging pushed updates // Base topic for messages acknowledging pushed updates
val PUSH_ACK_TOPIC = "platform.network_map.push_ack" val PUSH_ACK_TOPIC = "platform.network_map.push_ack"
val type = ServiceType.corda.getSubType("network_map") val type = ServiceType.networkMap
} }
data class FetchMapRequest(val subscribe: Boolean, data class FetchMapRequest(val subscribe: Boolean,

View File

@ -1,4 +1,3 @@
# Register a ServiceLoader service extending from net.corda.core.node.CordaPluginRegistry # Register a ServiceLoader service extending from net.corda.core.node.CordaPluginRegistry
net.corda.node.services.NotaryChange$Plugin net.corda.node.services.NotaryChange$Plugin
net.corda.node.services.persistence.DataVending$Plugin net.corda.node.services.persistence.DataVending$Plugin
net.corda.node.serialization.DefaultWhitelist

View File

@ -13,13 +13,13 @@ import net.corda.core.transactions.SignedTransaction
import net.corda.flows.CashIssueFlow import net.corda.flows.CashIssueFlow
import net.corda.flows.CashPaymentFlow import net.corda.flows.CashPaymentFlow
import net.corda.node.internal.CordaRPCOpsImpl import net.corda.node.internal.CordaRPCOpsImpl
import net.corda.node.services.User
import net.corda.node.services.messaging.CURRENT_RPC_USER
import net.corda.node.services.messaging.PermissionException
import net.corda.node.services.network.NetworkMapService import net.corda.node.services.network.NetworkMapService
import net.corda.node.services.startFlowPermission import net.corda.node.services.startFlowPermission
import net.corda.node.services.transactions.SimpleNotaryService import net.corda.node.services.transactions.SimpleNotaryService
import net.corda.node.utilities.databaseTransaction import net.corda.node.utilities.databaseTransaction
import net.corda.nodeapi.CURRENT_RPC_USER
import net.corda.nodeapi.PermissionException
import net.corda.nodeapi.User
import net.corda.testing.expect import net.corda.testing.expect
import net.corda.testing.expectEvents import net.corda.testing.expectEvents
import net.corda.testing.node.MockNetwork import net.corda.testing.node.MockNetwork

View File

@ -2,6 +2,7 @@ package net.corda.node.services
import com.typesafe.config.ConfigFactory import com.typesafe.config.ConfigFactory
import net.corda.node.services.config.FullNodeConfiguration import net.corda.node.services.config.FullNodeConfiguration
import net.corda.nodeapi.User
import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThat
import org.assertj.core.api.Assertions.assertThatThrownBy import org.assertj.core.api.Assertions.assertThatThrownBy
import org.junit.Test import org.junit.Test

View File

@ -49,7 +49,7 @@ dependencies {
compile "org.eclipse.jetty:jetty-webapp:${jetty_version}" compile "org.eclipse.jetty:jetty-webapp:${jetty_version}"
compile "javax.servlet:javax.servlet-api:3.1.0" compile "javax.servlet:javax.servlet-api:3.1.0"
compile "org.jolokia:jolokia-agent-war:$jolokia_version" compile "org.jolokia:jolokia-agent-war:$jolokia_version"
compile "commons-fileupload:commons-fileupload:1.3.2" compile "commons-fileupload:commons-fileupload:$fileupload_version"
// Jersey for JAX-RS implementation for use in Jetty // Jersey for JAX-RS implementation for use in Jetty
compile "org.glassfish.jersey.core:jersey-server:${jersey_version}" compile "org.glassfish.jersey.core:jersey-server:${jersey_version}"

View File

@ -1,12 +1,12 @@
package net.corda.webserver.internal package net.corda.webserver.internal
import net.corda.client.rpc.CordaRPCClient
import net.corda.core.messaging.CordaRPCOps import net.corda.core.messaging.CordaRPCOps
import net.corda.core.node.CordaPluginRegistry import net.corda.core.node.CordaPluginRegistry
import net.corda.core.utilities.loggerFor import net.corda.core.utilities.loggerFor
import net.corda.node.printBasicNodeInfo import net.corda.node.printBasicNodeInfo
import net.corda.node.services.config.FullNodeConfiguration import net.corda.node.services.config.FullNodeConfiguration
import net.corda.node.services.messaging.ArtemisMessagingComponent import net.corda.nodeapi.ArtemisMessagingComponent
import net.corda.node.services.messaging.CordaRPCClient
import net.corda.webserver.servlets.AttachmentDownloadServlet import net.corda.webserver.servlets.AttachmentDownloadServlet
import net.corda.webserver.servlets.DataUploadServlet import net.corda.webserver.servlets.DataUploadServlet
import net.corda.webserver.servlets.ObjectMapperConfig import net.corda.webserver.servlets.ObjectMapperConfig
@ -23,7 +23,6 @@ import org.glassfish.jersey.server.ResourceConfig
import org.glassfish.jersey.server.ServerProperties import org.glassfish.jersey.server.ServerProperties
import org.glassfish.jersey.servlet.ServletContainer import org.glassfish.jersey.servlet.ServletContainer
import java.lang.reflect.InvocationTargetException import java.lang.reflect.InvocationTargetException
import java.net.InetAddress
import java.util.* import java.util.*
class NodeWebServer(val config: FullNodeConfiguration) { class NodeWebServer(val config: FullNodeConfiguration) {

View File

@ -4,8 +4,8 @@ import com.google.common.util.concurrent.Futures
import net.corda.core.getOrThrow import net.corda.core.getOrThrow
import net.corda.core.node.services.ServiceInfo import net.corda.core.node.services.ServiceInfo
import net.corda.node.driver.driver import net.corda.node.driver.driver
import net.corda.node.services.User
import net.corda.node.services.transactions.SimpleNotaryService import net.corda.node.services.transactions.SimpleNotaryService
import net.corda.nodeapi.User
import org.junit.Test import org.junit.Test
import java.util.concurrent.CompletableFuture import java.util.concurrent.CompletableFuture

View File

@ -2,6 +2,7 @@ package net.corda.attachmentdemo
import com.google.common.net.HostAndPort import com.google.common.net.HostAndPort
import joptsimple.OptionParser import joptsimple.OptionParser
import net.corda.client.rpc.CordaRPCClient
import net.corda.nodeapi.config.SSLConfiguration import net.corda.nodeapi.config.SSLConfiguration
import net.corda.core.contracts.TransactionType import net.corda.core.contracts.TransactionType
import net.corda.core.crypto.Party import net.corda.core.crypto.Party
@ -12,7 +13,6 @@ import net.corda.core.messaging.CordaRPCOps
import net.corda.core.messaging.startFlow import net.corda.core.messaging.startFlow
import net.corda.core.utilities.Emoji import net.corda.core.utilities.Emoji
import net.corda.flows.FinalityFlow import net.corda.flows.FinalityFlow
import net.corda.node.services.messaging.CordaRPCClient
import net.corda.testing.ALICE_KEY import net.corda.testing.ALICE_KEY
import java.nio.file.Path import java.nio.file.Path
import java.nio.file.Paths import java.nio.file.Paths

View File

@ -3,8 +3,8 @@ package net.corda.attachmentdemo
import net.corda.core.div import net.corda.core.div
import net.corda.core.node.services.ServiceInfo import net.corda.core.node.services.ServiceInfo
import net.corda.node.driver.driver import net.corda.node.driver.driver
import net.corda.node.services.User
import net.corda.node.services.transactions.SimpleNotaryService import net.corda.node.services.transactions.SimpleNotaryService
import net.corda.nodeapi.User
import java.nio.file.Paths import java.nio.file.Paths
/** /**

View File

@ -49,7 +49,7 @@ dependencies {
runtime project(path: ":node:webserver:webcapsule", configuration: 'runtimeArtifacts') runtime project(path: ":node:webserver:webcapsule", configuration: 'runtimeArtifacts')
compile project(':core') compile project(':core')
compile project(':client:jfx') compile project(':client:jfx')
compile project(':node') compile project(':client:rpc')
compile project(':finance') compile project(':finance')
compile project(':test-utils') compile project(':test-utils')

View File

@ -7,7 +7,6 @@ import net.corda.core.getOrThrow
import net.corda.core.node.services.ServiceInfo import net.corda.core.node.services.ServiceInfo
import net.corda.node.driver.driver import net.corda.node.driver.driver
import net.corda.node.services.transactions.SimpleNotaryService import net.corda.node.services.transactions.SimpleNotaryService
import net.corda.node.utilities.getHostAndPort
import org.junit.Test import org.junit.Test
class BankOfCordaHttpAPITest { class BankOfCordaHttpAPITest {

View File

@ -7,9 +7,9 @@ import net.corda.core.messaging.startFlow
import net.corda.core.node.services.ServiceInfo import net.corda.core.node.services.ServiceInfo
import net.corda.flows.IssuerFlow.IssuanceRequester import net.corda.flows.IssuerFlow.IssuanceRequester
import net.corda.node.driver.driver import net.corda.node.driver.driver
import net.corda.node.services.User
import net.corda.node.services.startFlowPermission import net.corda.node.services.startFlowPermission
import net.corda.node.services.transactions.SimpleNotaryService import net.corda.node.services.transactions.SimpleNotaryService
import net.corda.nodeapi.User
import net.corda.testing.BOC_PARTY_REF import net.corda.testing.BOC_PARTY_REF
import net.corda.testing.expect import net.corda.testing.expect
import net.corda.testing.expectEvents import net.corda.testing.expectEvents

View File

@ -10,9 +10,9 @@ import net.corda.core.node.services.ServiceType
import net.corda.core.transactions.SignedTransaction import net.corda.core.transactions.SignedTransaction
import net.corda.flows.CashPaymentFlow import net.corda.flows.CashPaymentFlow
import net.corda.node.driver.driver import net.corda.node.driver.driver
import net.corda.node.services.User
import net.corda.node.services.startFlowPermission import net.corda.node.services.startFlowPermission
import net.corda.node.services.transactions.SimpleNotaryService import net.corda.node.services.transactions.SimpleNotaryService
import net.corda.nodeapi.User
import kotlin.system.exitProcess import kotlin.system.exitProcess
/** /**

View File

@ -2,6 +2,7 @@ package net.corda.bank.api
import com.google.common.net.HostAndPort import com.google.common.net.HostAndPort
import net.corda.bank.api.BankOfCordaWebApi.IssueRequestParams import net.corda.bank.api.BankOfCordaWebApi.IssueRequestParams
import net.corda.client.rpc.CordaRPCClient
import net.corda.core.contracts.Amount import net.corda.core.contracts.Amount
import net.corda.core.contracts.currency import net.corda.core.contracts.currency
import net.corda.core.getOrThrow import net.corda.core.getOrThrow
@ -9,7 +10,6 @@ import net.corda.core.messaging.startFlow
import net.corda.core.serialization.OpaqueBytes import net.corda.core.serialization.OpaqueBytes
import net.corda.core.transactions.SignedTransaction import net.corda.core.transactions.SignedTransaction
import net.corda.flows.IssuerFlow.IssuanceRequester import net.corda.flows.IssuerFlow.IssuanceRequester
import net.corda.node.services.messaging.CordaRPCClient
import net.corda.testing.http.HttpApi import net.corda.testing.http.HttpApi
/** /**

View File

@ -2,6 +2,7 @@ package net.corda.irs
import com.google.common.net.HostAndPort import com.google.common.net.HostAndPort
import com.google.common.util.concurrent.Futures import com.google.common.util.concurrent.Futures
import net.corda.client.rpc.CordaRPCClient
import net.corda.core.crypto.Party import net.corda.core.crypto.Party
import net.corda.core.getOrThrow import net.corda.core.getOrThrow
import net.corda.core.node.services.ServiceInfo import net.corda.core.node.services.ServiceInfo
@ -11,10 +12,9 @@ import net.corda.irs.utilities.postJson
import net.corda.irs.utilities.putJson import net.corda.irs.utilities.putJson
import net.corda.irs.utilities.uploadFile import net.corda.irs.utilities.uploadFile
import net.corda.node.driver.driver import net.corda.node.driver.driver
import net.corda.node.services.User
import net.corda.node.services.config.FullNodeConfiguration import net.corda.node.services.config.FullNodeConfiguration
import net.corda.node.services.messaging.CordaRPCClient
import net.corda.node.services.transactions.SimpleNotaryService import net.corda.node.services.transactions.SimpleNotaryService
import net.corda.nodeapi.User
import net.corda.testing.IntegrationTestCategory import net.corda.testing.IntegrationTestCategory
import org.apache.commons.io.IOUtils import org.apache.commons.io.IOUtils
import org.junit.Test import org.junit.Test

View File

@ -49,7 +49,7 @@ dependencies {
runtime project(path: ":node:webserver:webcapsule", configuration: 'runtimeArtifacts') runtime project(path: ":node:webserver:webcapsule", configuration: 'runtimeArtifacts')
compile project(':core') compile project(':core')
compile project(':client:jfx') compile project(':client:jfx')
compile project(':node') compile project(':client:rpc')
compile project(':test-utils') compile project(':test-utils')
// Javax is required for webapis // Javax is required for webapis

View File

@ -2,8 +2,8 @@ package net.corda.notarydemo
import net.corda.core.div import net.corda.core.div
import net.corda.node.driver.driver import net.corda.node.driver.driver
import net.corda.node.services.User
import net.corda.node.services.transactions.RaftValidatingNotaryService import net.corda.node.services.transactions.RaftValidatingNotaryService
import net.corda.nodeapi.User
import java.nio.file.Paths import java.nio.file.Paths
/** Creates and starts all nodes required for the demo. */ /** Creates and starts all nodes required for the demo. */

View File

@ -3,6 +3,7 @@ package net.corda.notarydemo
import com.google.common.net.HostAndPort import com.google.common.net.HostAndPort
import com.google.common.util.concurrent.Futures import com.google.common.util.concurrent.Futures
import joptsimple.OptionParser import joptsimple.OptionParser
import net.corda.client.rpc.CordaRPCClient
import net.corda.nodeapi.config.SSLConfiguration import net.corda.nodeapi.config.SSLConfiguration
import net.corda.core.crypto.toStringShort import net.corda.core.crypto.toStringShort
import net.corda.core.div import net.corda.core.div
@ -11,7 +12,6 @@ import net.corda.core.messaging.CordaRPCOps
import net.corda.core.messaging.startFlow import net.corda.core.messaging.startFlow
import net.corda.core.transactions.SignedTransaction import net.corda.core.transactions.SignedTransaction
import net.corda.flows.NotaryFlow import net.corda.flows.NotaryFlow
import net.corda.node.services.messaging.CordaRPCClient
import net.corda.notarydemo.flows.DummyIssueAndMove import net.corda.notarydemo.flows.DummyIssueAndMove
import java.nio.file.Path import java.nio.file.Path
import java.nio.file.Paths import java.nio.file.Paths

View File

@ -4,7 +4,6 @@ import co.paralleluniverse.fibers.Suspendable
import net.corda.core.contracts.DummyContract import net.corda.core.contracts.DummyContract
import net.corda.core.crypto.Party import net.corda.core.crypto.Party
import net.corda.core.flows.FlowLogic import net.corda.core.flows.FlowLogic
import net.corda.core.node.recordTransactions
import net.corda.core.transactions.SignedTransaction import net.corda.core.transactions.SignedTransaction
import java.util.* import java.util.*

View File

@ -5,7 +5,6 @@ import net.corda.core.node.CordaPluginRegistry
import net.corda.core.transactions.SignedTransaction import net.corda.core.transactions.SignedTransaction
import net.corda.flows.NotaryFlow import net.corda.flows.NotaryFlow
import net.corda.notarydemo.flows.DummyIssueAndMove import net.corda.notarydemo.flows.DummyIssueAndMove
import java.util.function.Function
class NotaryDemoPlugin : CordaPluginRegistry() { class NotaryDemoPlugin : CordaPluginRegistry() {
// A list of protocols that are required for this cordapp // A list of protocols that are required for this cordapp

View File

@ -1,13 +1,13 @@
package net.corda.traderdemo package net.corda.traderdemo
import com.google.common.util.concurrent.Futures import com.google.common.util.concurrent.Futures
import net.corda.client.rpc.CordaRPCClient
import net.corda.core.getOrThrow import net.corda.core.getOrThrow
import net.corda.core.node.services.ServiceInfo import net.corda.core.node.services.ServiceInfo
import net.corda.flows.IssuerFlow import net.corda.flows.IssuerFlow
import net.corda.node.services.User
import net.corda.node.services.messaging.CordaRPCClient
import net.corda.node.services.startFlowPermission import net.corda.node.services.startFlowPermission
import net.corda.node.services.transactions.SimpleNotaryService import net.corda.node.services.transactions.SimpleNotaryService
import net.corda.nodeapi.User
import net.corda.testing.node.NodeBasedTest import net.corda.testing.node.NodeBasedTest
import org.junit.Test import org.junit.Test

View File

@ -3,12 +3,12 @@ package net.corda.traderdemo
import net.corda.flows.IssuerFlow import net.corda.flows.IssuerFlow
import net.corda.core.node.services.ServiceInfo import net.corda.core.node.services.ServiceInfo
import net.corda.node.driver.driver import net.corda.node.driver.driver
import net.corda.node.services.User
import net.corda.node.services.startFlowPermission import net.corda.node.services.startFlowPermission
import net.corda.node.services.transactions.SimpleNotaryService import net.corda.node.services.transactions.SimpleNotaryService
import net.corda.testing.BOC import net.corda.testing.BOC
import java.nio.file.Paths import java.nio.file.Paths
import net.corda.core.div import net.corda.core.div
import net.corda.nodeapi.User
/** /**
* This file is exclusively for being able to run your nodes through an IDE (as opposed to running deployNodes) * This file is exclusively for being able to run your nodes through an IDE (as opposed to running deployNodes)

View File

@ -2,14 +2,10 @@ package net.corda.traderdemo
import com.google.common.net.HostAndPort import com.google.common.net.HostAndPort
import joptsimple.OptionParser import joptsimple.OptionParser
import net.corda.nodeapi.config.SSLConfiguration import net.corda.client.rpc.CordaRPCClient
import net.corda.core.contracts.DOLLARS import net.corda.core.contracts.DOLLARS
import net.corda.core.div
import net.corda.core.utilities.loggerFor import net.corda.core.utilities.loggerFor
import net.corda.node.services.messaging.CordaRPCClient
import org.slf4j.Logger import org.slf4j.Logger
import java.nio.file.Path
import java.nio.file.Paths
import kotlin.system.exitProcess import kotlin.system.exitProcess
/** /**

View File

@ -3,8 +3,6 @@ package net.corda.traderdemo.plugin
import net.corda.core.contracts.Amount import net.corda.core.contracts.Amount
import net.corda.core.crypto.Party import net.corda.core.crypto.Party
import net.corda.core.node.CordaPluginRegistry import net.corda.core.node.CordaPluginRegistry
import net.corda.core.serialization.OpaqueBytes
import net.corda.flows.IssuerFlow
import net.corda.traderdemo.flow.BuyerFlow import net.corda.traderdemo.flow.BuyerFlow
import net.corda.traderdemo.flow.SellerFlow import net.corda.traderdemo.flow.SellerFlow
import java.util.function.Function import java.util.function.Function

View File

@ -13,6 +13,7 @@ include 'node:webserver:webcapsule'
include 'client:jackson' include 'client:jackson'
include 'client:jfx' include 'client:jfx'
include 'client:mock' include 'client:mock'
include 'client:rpc'
include 'experimental' include 'experimental'
include 'experimental:sandbox' include 'experimental:sandbox'
include 'test-utils' include 'test-utils'

View File

@ -2,9 +2,9 @@ package net.corda.testing.messaging
import com.google.common.net.HostAndPort import com.google.common.net.HostAndPort
import net.corda.nodeapi.config.SSLConfiguration import net.corda.nodeapi.config.SSLConfiguration
import net.corda.nodeapi.ArtemisMessagingComponent
import net.corda.nodeapi.ArtemisTcpTransport import net.corda.nodeapi.ArtemisTcpTransport
import net.corda.nodeapi.ConnectionDirection import net.corda.nodeapi.ConnectionDirection
import net.corda.node.services.messaging.ArtemisMessagingComponent
import net.corda.testing.configureTestSSL import net.corda.testing.configureTestSSL
import org.apache.activemq.artemis.api.core.client.* import org.apache.activemq.artemis.api.core.client.*

View File

@ -9,11 +9,11 @@ import net.corda.core.map
import net.corda.core.node.services.ServiceInfo import net.corda.core.node.services.ServiceInfo
import net.corda.core.node.services.ServiceType import net.corda.core.node.services.ServiceType
import net.corda.node.internal.Node import net.corda.node.internal.Node
import net.corda.node.services.User
import net.corda.node.services.config.ConfigHelper import net.corda.node.services.config.ConfigHelper
import net.corda.node.services.config.FullNodeConfiguration import net.corda.node.services.config.FullNodeConfiguration
import net.corda.node.services.transactions.RaftValidatingNotaryService import net.corda.node.services.transactions.RaftValidatingNotaryService
import net.corda.node.utilities.ServiceIdentityGenerator import net.corda.node.utilities.ServiceIdentityGenerator
import net.corda.nodeapi.User
import net.corda.testing.MOCK_NODE_VERSION_INFO import net.corda.testing.MOCK_NODE_VERSION_INFO
import net.corda.testing.getFreeLocalPorts import net.corda.testing.getFreeLocalPorts
import org.junit.After import org.junit.After

View File

@ -49,9 +49,10 @@ dependencies {
// Controls FX: more java FX components http://fxexperience.com/controlsfx/ // Controls FX: more java FX components http://fxexperience.com/controlsfx/
compile "org.controlsfx:controlsfx:$controlsfx_version" compile "org.controlsfx:controlsfx:$controlsfx_version"
// ONLY USING THE RPC CLIENT!? compile (project(':client:rpc')) {
compile (project(':node')) { exclude module: 'junit'
exclude module: 'kotlin-test' }
compile (project(':finance')) {
exclude module: 'junit' exclude module: 'junit'
} }

View File

@ -3,10 +3,10 @@ package net.corda.demobench.rpc
import com.google.common.net.HostAndPort import com.google.common.net.HostAndPort
import java.util.* import java.util.*
import java.util.concurrent.TimeUnit.SECONDS import java.util.concurrent.TimeUnit.SECONDS
import net.corda.client.rpc.CordaRPCClient
import net.corda.core.messaging.CordaRPCOps import net.corda.core.messaging.CordaRPCOps
import net.corda.demobench.loggerFor import net.corda.demobench.loggerFor
import net.corda.demobench.model.NodeConfig import net.corda.demobench.model.NodeConfig
import net.corda.node.services.messaging.CordaRPCClient
class NodeRPC(config: NodeConfig, start: () -> Unit, invoke: (CordaRPCOps) -> Unit): AutoCloseable { class NodeRPC(config: NodeConfig, start: () -> Unit, invoke: (CordaRPCOps) -> Unit): AutoCloseable {

View File

@ -132,8 +132,8 @@ class NodeTerminalView : Fragment() {
) )
Platform.runLater { Platform.runLater {
states.value = statesInVault.first.size.toString() states.value = fetchAndDrop(statesInVault).size.toString()
transactions.value = verifiedTx.first.size.toString() transactions.value = fetchAndDrop(verifiedTx).size.toString()
balance.value = if (cashBalances.isNullOrEmpty()) "0" else cashBalances balance.value = if (cashBalances.isNullOrEmpty()) "0" else cashBalances
} }
} catch (e: Exception) { } catch (e: Exception) {
@ -156,10 +156,15 @@ class NodeTerminalView : Fragment() {
// TODO - Force a repaint somehow? My naive attempts have not worked. // TODO - Force a repaint somehow? My naive attempts have not worked.
} }
// TODO - Will change when we modify RPC Observables handling.
private fun <T> fetchAndDrop(pair: Pair<T, rx.Observable<*>>): T {
pair.second.subscribe().unsubscribe()
return pair.first
}
class TerminalSettingsProvider : DefaultSettingsProvider() { class TerminalSettingsProvider : DefaultSettingsProvider() {
override fun getDefaultStyle() = TextStyle(TerminalColor.WHITE, TerminalColor.BLACK) override fun getDefaultStyle() = TextStyle(TerminalColor.WHITE, TerminalColor.BLACK)
override fun emulateX11CopyPaste() = true override fun emulateX11CopyPaste() = true
} }
} }

View File

@ -33,6 +33,7 @@ repositories {
dependencies { dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
testCompile "junit:junit:$junit_version" testCompile "junit:junit:$junit_version"
// TornadoFX: A lightweight Kotlin framework for working with JavaFX UI's. // TornadoFX: A lightweight Kotlin framework for working with JavaFX UI's.

View File

@ -26,9 +26,9 @@ import net.corda.flows.CashPaymentFlow
import net.corda.flows.IssuerFlow.IssuanceRequester import net.corda.flows.IssuerFlow.IssuanceRequester
import net.corda.node.driver.PortAllocation import net.corda.node.driver.PortAllocation
import net.corda.node.driver.driver import net.corda.node.driver.driver
import net.corda.node.services.User
import net.corda.node.services.startFlowPermission import net.corda.node.services.startFlowPermission
import net.corda.node.services.transactions.SimpleNotaryService import net.corda.node.services.transactions.SimpleNotaryService
import net.corda.nodeapi.User
import org.apache.commons.lang.SystemUtils import org.apache.commons.lang.SystemUtils
import org.controlsfx.dialog.ExceptionDialog import org.controlsfx.dialog.ExceptionDialog
import tornadofx.App import tornadofx.App

View File

@ -25,6 +25,8 @@ mainClassName = 'net.corda.loadtest.MainKt'
dependencies { dependencies {
compile project(':client:mock') compile project(':client:mock')
compile project(':client:rpc')
compile project(':node')
// https://mvnrepository.com/artifact/com.jcraft/jsch // https://mvnrepository.com/artifact/com.jcraft/jsch
compile group: 'com.jcraft', name: 'jsch', version: '0.1.54' compile group: 'com.jcraft', name: 'jsch', version: '0.1.54'

View File

@ -7,12 +7,9 @@ import com.jcraft.jsch.agentproxy.connector.SSHAgentConnector
import com.jcraft.jsch.agentproxy.usocket.JNAUSocketFactory import com.jcraft.jsch.agentproxy.usocket.JNAUSocketFactory
import kotlinx.support.jdk8.collections.parallelStream import kotlinx.support.jdk8.collections.parallelStream
import kotlinx.support.jdk8.streams.toList import kotlinx.support.jdk8.streams.toList
import net.corda.core.createDirectories import net.corda.client.rpc.CordaRPCClient
import net.corda.core.div
import net.corda.core.messaging.CordaRPCOps import net.corda.core.messaging.CordaRPCOps
import net.corda.node.driver.PortAllocation import net.corda.node.driver.PortAllocation
import net.corda.nodeapi.config.SSLConfiguration
import net.corda.node.services.messaging.CordaRPCClient
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import java.io.ByteArrayOutputStream import java.io.ByteArrayOutputStream
import java.io.Closeable import java.io.Closeable