mirror of
https://github.com/corda/corda.git
synced 2025-02-05 18:49:14 +00:00
Fixes from code review.
This commit is contained in:
parent
dd0d7a0cf4
commit
963d015c4d
@ -11,7 +11,7 @@ buildscript {
|
||||
ext.java_home = System.properties.'java.home'
|
||||
ext.pkg_source = "$buildDir/packagesrc"
|
||||
ext.dist_source = "$pkg_source/demobench-$version"
|
||||
ext.pkg_version = "$version".indexOf('-') >= 0 ? "$version".substring(0, "$version".indexOf('-')) : "$version"
|
||||
ext.pkg_version = "$version".indexOf('-') >= 0 ? "$version".substring(0, "$version".indexOf('-')) : version
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
@ -79,7 +79,7 @@ dependencies {
|
||||
compile ':jediterm-terminal-2.5'
|
||||
compile ':pty4j-0.7.2'
|
||||
|
||||
testCompile group: 'junit', name: 'junit', version: "$junit_version"
|
||||
testCompile group: 'junit', name: 'junit', version: junit_version
|
||||
}
|
||||
|
||||
// We don't want the Node to drag these transitive dependencies in either!
|
||||
@ -92,6 +92,7 @@ configurations.all {
|
||||
jar {
|
||||
manifest {
|
||||
attributes(
|
||||
'Corda-Version': corda_version,
|
||||
'Main-Class': mainClassName,
|
||||
'Class-Path': configurations.compile.collect { it.getName() }.join(' ')
|
||||
)
|
||||
@ -133,11 +134,11 @@ distributions {
|
||||
task javapackage(dependsOn: 'distZip') {
|
||||
|
||||
doLast {
|
||||
delete(["$pkg_source", "$buildDir/exedir"])
|
||||
delete([pkg_source, "$buildDir/exedir"])
|
||||
|
||||
copy {
|
||||
from(zipTree(distZip.outputs.files.singleFile))
|
||||
into "$pkg_source"
|
||||
into pkg_source
|
||||
}
|
||||
|
||||
copy {
|
||||
@ -164,7 +165,7 @@ task javapackage(dependsOn: 'distZip') {
|
||||
include '**/*.manifest'
|
||||
}
|
||||
filter {
|
||||
line -> line.replaceAll('@pkg_version@', "$pkg_version")
|
||||
line -> line.replaceAll('@pkg_version@', pkg_version)
|
||||
}
|
||||
into "$pkg_source/package"
|
||||
}
|
||||
@ -174,8 +175,8 @@ task javapackage(dependsOn: 'distZip') {
|
||||
classpath: "$pkg_source:$java_home/../lib/ant-javafx.jar"
|
||||
)
|
||||
|
||||
ant.deploy(nativeBundles: "$packageType", outdir: "$buildDir/exedir", outfile: 'DemoBench', verbose: 'true') {
|
||||
application(name: 'DemoBench', version: "$pkg_version", mainClass: "$mainClassName")
|
||||
ant.deploy(nativeBundles: packageType, outdir: "$buildDir/exedir", outfile: 'DemoBench', verbose: 'true') {
|
||||
application(name: 'DemoBench', version: pkg_version, mainClass: mainClassName)
|
||||
info(title: 'DemoBench', vendor: 'R3', description: 'A sales and educational tool for demonstrating Corda.')
|
||||
resources {
|
||||
fileset(dir: "$dist_source/lib", type: 'jar') {
|
||||
@ -189,7 +190,7 @@ task javapackage(dependsOn: 'distZip') {
|
||||
include(name: "linux/**/*.so")
|
||||
}
|
||||
|
||||
fileset(dir: "$dist_source", type: 'data') {
|
||||
fileset(dir: dist_source, type: 'data') {
|
||||
include(name: 'corda/*.jar')
|
||||
include(name: 'plugins/*.jar')
|
||||
include(name: 'explorer/*.jar')
|
||||
|
@ -11,9 +11,9 @@ import tornadofx.Controller
|
||||
|
||||
class NodeController : Controller() {
|
||||
private companion object {
|
||||
const val FIRST_PORT = 10000
|
||||
const val MIN_PORT = 1024
|
||||
const val MAX_PORT = 65535
|
||||
const val firstPort = 10000
|
||||
const val minPort = 1024
|
||||
const val maxPort = 65535
|
||||
}
|
||||
|
||||
private val jvm by inject<JVMConfig>()
|
||||
@ -27,7 +27,7 @@ class NodeController : Controller() {
|
||||
private val command = jvm.commandFor(cordaPath)
|
||||
|
||||
private val nodes = LinkedHashMap<String, NodeConfig>()
|
||||
private val port = AtomicInteger(FIRST_PORT)
|
||||
private val port = AtomicInteger(firstPort)
|
||||
|
||||
private var networkMapConfig: NetworkMapConfig? = null
|
||||
|
||||
@ -85,7 +85,7 @@ class NodeController : Controller() {
|
||||
}
|
||||
}
|
||||
|
||||
fun isPortValid(port: Int): Boolean = (port >= MIN_PORT) && (port <= MAX_PORT)
|
||||
fun isPortValid(port: Int): Boolean = (port >= minPort) && (port <= maxPort)
|
||||
|
||||
fun keyExists(key: String) = nodes.keys.contains(key)
|
||||
|
||||
|
@ -12,7 +12,7 @@ class NodeRPC(config: NodeConfig, start: () -> Unit, invoke: (CordaRPCOps) -> Un
|
||||
|
||||
private companion object {
|
||||
val log = loggerFor<NodeRPC>()
|
||||
val ONE_SECOND = SECONDS.toMillis(1)
|
||||
val oneSecond = SECONDS.toMillis(1)
|
||||
}
|
||||
|
||||
private val rpcClient = CordaRPCClient(HostAndPort.fromParts("localhost", config.artemisPort), config.ssl)
|
||||
@ -37,7 +37,7 @@ class NodeRPC(config: NodeConfig, start: () -> Unit, invoke: (CordaRPCOps) -> Un
|
||||
override fun run() {
|
||||
invoke(ops)
|
||||
}
|
||||
}, 0, ONE_SECOND)
|
||||
}, 0, oneSecond)
|
||||
} catch (e: Exception) {
|
||||
log.warn("Node '{}' not ready yet (Error: {})", config.legalName, e.message)
|
||||
}
|
||||
@ -45,7 +45,7 @@ class NodeRPC(config: NodeConfig, start: () -> Unit, invoke: (CordaRPCOps) -> Un
|
||||
}
|
||||
|
||||
// Wait 5 seconds for the node to start, and then poll once per second.
|
||||
timer.schedule(setupTask, 5 * ONE_SECOND, ONE_SECOND)
|
||||
timer.schedule(setupTask, 5 * oneSecond, oneSecond)
|
||||
}
|
||||
|
||||
override fun close() {
|
||||
|
@ -18,8 +18,8 @@ class NodeTabView : Fragment() {
|
||||
private val showConfig by param<Boolean>()
|
||||
|
||||
private companion object {
|
||||
val INTEGER_FORMAT = DecimalFormat()
|
||||
val NOT_NUMBER = "[^\\d]".toRegex()
|
||||
val integerFormat = DecimalFormat()
|
||||
val notNumber = "[^\\d]".toRegex()
|
||||
}
|
||||
|
||||
private val model = NodeDataModel()
|
||||
@ -70,13 +70,13 @@ class NodeTabView : Fragment() {
|
||||
}
|
||||
}
|
||||
field("P2P Port") {
|
||||
textfield(model.artemisPort, NumberStringConverter(INTEGER_FORMAT)) {
|
||||
textfield(model.artemisPort, NumberStringConverter(integerFormat)) {
|
||||
minWidth = 100.0
|
||||
maxWidth = 100.0
|
||||
validator {
|
||||
if ((it == null) || it.isEmpty()) {
|
||||
error("Port number required")
|
||||
} else if (it.contains(NOT_NUMBER)) {
|
||||
} else if (it.contains(notNumber)) {
|
||||
error("Invalid port number")
|
||||
} else {
|
||||
val port = it.toInt()
|
||||
@ -94,13 +94,13 @@ class NodeTabView : Fragment() {
|
||||
}
|
||||
}
|
||||
field("Web Port") {
|
||||
textfield(model.webPort, NumberStringConverter(INTEGER_FORMAT)) {
|
||||
textfield(model.webPort, NumberStringConverter(integerFormat)) {
|
||||
minWidth = 100.0
|
||||
maxWidth = 100.0
|
||||
validator {
|
||||
if ((it == null) || it.isEmpty()) {
|
||||
error("Port number required")
|
||||
} else if (it.contains(NOT_NUMBER)) {
|
||||
} else if (it.contains(notNumber)) {
|
||||
error("Invalid port number")
|
||||
} else {
|
||||
val port = it.toInt()
|
||||
@ -118,13 +118,13 @@ class NodeTabView : Fragment() {
|
||||
}
|
||||
}
|
||||
field("Database Port") {
|
||||
textfield(model.h2Port, NumberStringConverter(INTEGER_FORMAT)) {
|
||||
textfield(model.h2Port, NumberStringConverter(integerFormat)) {
|
||||
minWidth = 100.0
|
||||
maxWidth = 100.0
|
||||
validator {
|
||||
if ((it == null) || it.isEmpty()) {
|
||||
error("Port number required")
|
||||
} else if (it.contains(NOT_NUMBER)) {
|
||||
} else if (it.contains(notNumber)) {
|
||||
error("Invalid port number")
|
||||
} else {
|
||||
val port = it.toInt()
|
||||
@ -168,7 +168,7 @@ class NodeTabView : Fragment() {
|
||||
get() = if (nodeController.hasNetworkMap()) serviceController.services else serviceController.notaries
|
||||
|
||||
init {
|
||||
INTEGER_FORMAT.isGroupingUsed = false
|
||||
integerFormat.isGroupingUsed = false
|
||||
|
||||
// Ensure that we destroy the terminal along with the tab.
|
||||
nodeTab.setOnCloseRequest {
|
||||
|
@ -36,6 +36,7 @@ task buildExplorerJAR(type: FatCapsule) {
|
||||
classifier 'fat'
|
||||
|
||||
capsuleManifest {
|
||||
applicationVersion = corda_version
|
||||
systemProperties['visualvm.display.name'] = 'Node Explorer'
|
||||
minJavaVersion = '1.8.0'
|
||||
// This version is known to work and avoids earlier 8u versions that have bugs.
|
||||
@ -49,6 +50,10 @@ task buildExplorerJAR(type: FatCapsule) {
|
||||
// If you change these flags, please also update Driver.kt
|
||||
jvmArgs = ['-Xmx200m', '-XX:+UseG1GC']
|
||||
}
|
||||
|
||||
manifest {
|
||||
attributes('Corda-Version': corda_version)
|
||||
}
|
||||
}
|
||||
|
||||
build.dependsOn buildExplorerJAR
|
||||
|
Loading…
x
Reference in New Issue
Block a user