mirror of
https://github.com/corda/corda.git
synced 2025-01-01 18:56:44 +00:00
Correct SIMM sample plugin
* Split SIMM plugin into separate plugin registry extension and web server plugin to resolve class loading error. * Rationalise differences between Bank of Corda and SIMM demo build scripts to make side by side comparison easier.
This commit is contained in:
parent
ac4725dc71
commit
7a8afa70ab
@ -23,7 +23,6 @@ configurations {
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
|
||||
testCompile "junit:junit:$junit_version"
|
||||
|
||||
// Corda integration dependencies
|
||||
cordaCompile project(path: ":node:capsule", configuration: 'runtimeArtifacts')
|
||||
@ -37,6 +36,12 @@ dependencies {
|
||||
|
||||
// Javax is required for webapis
|
||||
compile "org.glassfish.jersey.core:jersey-server:${jersey_version}"
|
||||
|
||||
// Cordapp dependencies
|
||||
// Specify your cordapp's dependencies below, including dependent cordapps
|
||||
|
||||
// Test dependencies
|
||||
testCompile "junit:junit:$junit_version"
|
||||
}
|
||||
|
||||
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
|
||||
|
@ -32,8 +32,11 @@ dependencies {
|
||||
cordaCompile project(path: ":node:capsule", configuration: 'runtimeArtifacts')
|
||||
cordaCompile project(path: ":webserver:webcapsule", configuration: 'runtimeArtifacts')
|
||||
cordaCompile project(':core')
|
||||
cordaCompile project(':webserver')
|
||||
cordaCompile project(':finance')
|
||||
cordaCompile project(':webserver')
|
||||
|
||||
// Javax is required for webapis
|
||||
compile "org.glassfish.jersey.core:jersey-server:${jersey_version}"
|
||||
|
||||
// Cordapp dependencies
|
||||
// Specify your cordapp's dependencies below, including dependent cordapps
|
||||
@ -48,6 +51,7 @@ dependencies {
|
||||
compile "com.opengamma.strata:strata-loader:${strata_version}"
|
||||
compile "com.opengamma.strata:strata-math:${strata_version}"
|
||||
|
||||
// Test dependencies
|
||||
testCompile project(':test-utils')
|
||||
testCompile "junit:junit:$junit_version"
|
||||
testCompile "org.assertj:assertj-core:${assertj_version}"
|
||||
|
@ -0,0 +1,17 @@
|
||||
package net.corda.vega.plugin
|
||||
|
||||
import net.corda.core.node.CordaPluginRegistry
|
||||
import net.corda.vega.api.PortfolioApi
|
||||
import net.corda.webserver.services.WebServerPluginRegistry
|
||||
import java.util.function.Function
|
||||
|
||||
/**
|
||||
* [SimmService] is the object that makes available the flows and services for the Simm agreement / evaluation flow.
|
||||
* It is loaded via discovery - see [CordaPluginRegistry].
|
||||
* It is also the object that enables a human usable web service for demo purpose
|
||||
* It is loaded via discovery see [WebServerPluginRegistry].
|
||||
*/
|
||||
class SimmPlugin : WebServerPluginRegistry {
|
||||
override val webApis = listOf(Function(::PortfolioApi))
|
||||
override val staticServeDirs: Map<String, String> = mapOf("simmvaluationdemo" to javaClass.classLoader.getResource("simmvaluationweb").toExternalForm())
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package net.corda.vega.plugin
|
||||
|
||||
import com.google.common.collect.Ordering
|
||||
import com.opengamma.strata.basics.currency.Currency
|
||||
import com.opengamma.strata.basics.currency.CurrencyAmount
|
||||
import com.opengamma.strata.basics.currency.MultiCurrencyAmount
|
||||
import com.opengamma.strata.basics.date.Tenor
|
||||
import com.opengamma.strata.collect.array.DoubleArray
|
||||
import com.opengamma.strata.market.curve.CurveName
|
||||
import com.opengamma.strata.market.param.CurrencyParameterSensitivities
|
||||
import com.opengamma.strata.market.param.CurrencyParameterSensitivity
|
||||
import com.opengamma.strata.market.param.TenorDateParameterMetadata
|
||||
import net.corda.core.node.CordaPluginRegistry
|
||||
import net.corda.core.serialization.SerializationCustomization
|
||||
import net.corda.vega.analytics.CordaMarketData
|
||||
import net.corda.vega.analytics.InitialMarginTriple
|
||||
import net.corda.webserver.services.WebServerPluginRegistry
|
||||
|
||||
/**
|
||||
* [SimmService] is the object that makes available the flows and services for the Simm agreement / evaluation flow.
|
||||
* It is loaded via discovery - see [CordaPluginRegistry].
|
||||
* It is also the object that enables a human usable web service for demo purpose
|
||||
* It is loaded via discovery see [WebServerPluginRegistry].
|
||||
*/
|
||||
class SimmPluginRegistry : CordaPluginRegistry() {
|
||||
override fun customizeSerialization(custom: SerializationCustomization): Boolean {
|
||||
custom.apply {
|
||||
// OpenGamma classes.
|
||||
addToWhitelist(MultiCurrencyAmount::class.java)
|
||||
addToWhitelist(Ordering.natural<Comparable<Any>>().javaClass)
|
||||
addToWhitelist(CurrencyAmount::class.java)
|
||||
addToWhitelist(Currency::class.java)
|
||||
addToWhitelist(InitialMarginTriple::class.java)
|
||||
addToWhitelist(CordaMarketData::class.java)
|
||||
addToWhitelist(CurrencyParameterSensitivities::class.java)
|
||||
addToWhitelist(CurrencyParameterSensitivity::class.java)
|
||||
addToWhitelist(DoubleArray::class.java)
|
||||
addToWhitelist(CurveName::class.java)
|
||||
addToWhitelist(TenorDateParameterMetadata::class.java)
|
||||
addToWhitelist(Tenor::class.java)
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
package net.corda.vega.services
|
||||
|
||||
import com.google.common.collect.Ordering
|
||||
import com.opengamma.strata.basics.currency.Currency
|
||||
import com.opengamma.strata.basics.currency.CurrencyAmount
|
||||
import com.opengamma.strata.basics.currency.MultiCurrencyAmount
|
||||
import com.opengamma.strata.basics.date.Tenor
|
||||
import com.opengamma.strata.collect.array.DoubleArray
|
||||
import com.opengamma.strata.market.curve.CurveName
|
||||
import com.opengamma.strata.market.param.CurrencyParameterSensitivities
|
||||
import com.opengamma.strata.market.param.CurrencyParameterSensitivity
|
||||
import com.opengamma.strata.market.param.TenorDateParameterMetadata
|
||||
import net.corda.core.node.CordaPluginRegistry
|
||||
import net.corda.core.serialization.SerializationCustomization
|
||||
import net.corda.vega.analytics.CordaMarketData
|
||||
import net.corda.vega.analytics.InitialMarginTriple
|
||||
import net.corda.vega.api.PortfolioApi
|
||||
import net.corda.webserver.services.WebServerPluginRegistry
|
||||
import java.util.function.Function
|
||||
|
||||
/**
|
||||
* [SimmService] is the object that makes available the flows and services for the Simm agreement / evaluation flow.
|
||||
* It is loaded via discovery - see [CordaPluginRegistry].
|
||||
* It is also the object that enables a human usable web service for demo purpose
|
||||
* It is loaded via discovery see [WebServerPluginRegistry].
|
||||
*/
|
||||
object SimmService {
|
||||
class Plugin : CordaPluginRegistry(), WebServerPluginRegistry {
|
||||
override val webApis = listOf(Function(::PortfolioApi))
|
||||
override val staticServeDirs: Map<String, String> = mapOf("simmvaluationdemo" to javaClass.classLoader.getResource("simmvaluationweb").toExternalForm())
|
||||
override fun customizeSerialization(custom: SerializationCustomization): Boolean {
|
||||
custom.apply {
|
||||
// OpenGamma classes.
|
||||
addToWhitelist(MultiCurrencyAmount::class.java)
|
||||
addToWhitelist(Ordering.natural<Comparable<Any>>().javaClass)
|
||||
addToWhitelist(CurrencyAmount::class.java)
|
||||
addToWhitelist(Currency::class.java)
|
||||
addToWhitelist(InitialMarginTriple::class.java)
|
||||
addToWhitelist(CordaMarketData::class.java)
|
||||
addToWhitelist(CurrencyParameterSensitivities::class.java)
|
||||
addToWhitelist(CurrencyParameterSensitivity::class.java)
|
||||
addToWhitelist(DoubleArray::class.java)
|
||||
addToWhitelist(CurveName::class.java)
|
||||
addToWhitelist(TenorDateParameterMetadata::class.java)
|
||||
addToWhitelist(Tenor::class.java)
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
@ -1,2 +1,2 @@
|
||||
# Register a ServiceLoader service extending from net.corda.core.node.CordaPluginRegistry
|
||||
net.corda.vega.services.SimmService$Plugin
|
||||
net.corda.vega.plugin.SimmPluginRegistry
|
||||
|
@ -1,2 +1,2 @@
|
||||
# Register a ServiceLoader service extending from net.corda.webserver.services.WebServerPluginRegistry
|
||||
net.corda.vega.services.SimmService$Plugin
|
||||
net.corda.vega.plugin.SimmPlugin
|
||||
|
Loading…
Reference in New Issue
Block a user