Extract common name from legal name to determine path

Rewrote node name to extract common name to use as the node path for samples, to work around characters
being incorrectly treated as separators.
This commit is contained in:
Ross Nicoll 2017-04-27 12:22:04 +01:00 committed by Chris Rankin
parent 71f6fe423e
commit cc86499217
4 changed files with 18 additions and 3 deletions
build.gradleconstants.properties
gradle-plugins/cordformation
build.gradle
src/main/groovy/net/corda/plugins

@ -24,7 +24,7 @@ buildscript {
ext.assertj_version = '3.6.1'
ext.slf4j_version = '1.7.25'
ext.log4j_version = '2.7'
ext.bouncycastle_version = '1.56'
ext.bouncycastle_version = constants.getProperty("bouncycastleVersion")
ext.guava_version = constants.getProperty("guavaVersion")
ext.quickcheck_version = '0.7'
ext.okhttp_version = '3.5.0'

@ -1,4 +1,5 @@
gradlePluginsVersion=0.11.1
gradlePluginsVersion=0.11.2
kotlinVersion=1.1.1
guavaVersion=21.0
bouncycastleVersion=1.56
typesafeConfigVersion=1.3.1

@ -4,6 +4,7 @@ buildscript {
file("$projectDir/../../constants.properties").withInputStream { constants.load(it) }
ext.kotlin_version = constants.getProperty("kotlinVersion")
ext.bouncycastle_version = constants.getProperty("bouncycastleVersion")
ext.typesafe_config_version = constants.getProperty("typesafeConfigVersion")
repositories {
@ -47,6 +48,9 @@ dependencies {
// TypeSafe Config: for simple and human friendly config files.
compile "com.typesafe:config:$typesafe_config_version"
// Bouncy Castle: for X.500 distinguished name manipulation
compile "org.bouncycastle:bcprov-jdk15on:${bouncycastle_version}"
}
task createNodeRunner(type: Jar, dependsOn: [classes]) {

@ -1,6 +1,8 @@
package net.corda.plugins
import com.typesafe.config.*
import org.bouncycastle.asn1.x500.X500Name
import org.bouncycastle.asn1.x500.style.BCStyle
import org.gradle.api.Project
import java.nio.charset.StandardCharsets
import java.nio.file.Files
@ -154,7 +156,15 @@ class Node {
}
void build(File rootDir) {
nodeDir = new File(rootDir, name.replaceAll("\\s",""))
def dirName
try {
X500Name x500Name = new X500Name(name)
dirName = x500Name.getRDNs(BCStyle.CN).getAt(0).getFirst().getValue().toString()
} catch(IllegalArgumentException ex) {
// Can't parse as an X500 name, use the full string
dirName = name
}
nodeDir = new File(rootDir, dirName.replaceAll("\\s",""))
configureRpcUsers()
installCordaJar()
installWebserverJar()