mirror of
https://github.com/corda/corda.git
synced 2024-12-28 16:58:55 +00:00
Ensure a DemoBench installation is relocatable.
This commit is contained in:
parent
d57f7cd557
commit
006fd98a51
@ -78,7 +78,10 @@ configurations.all {
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'Main-Class': mainClassName
|
||||
attributes(
|
||||
'Main-Class': mainClassName,
|
||||
'Class-Path': configurations.compile.collect { it.getName() }.join(' ')
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,18 @@ import tornadofx.addStageIcon
|
||||
*/
|
||||
|
||||
class DemoBench : App(DemoBenchView::class) {
|
||||
|
||||
/*
|
||||
* This entry point is needed by JavaPackager, as
|
||||
* otherwise the packaged application cannot run.
|
||||
*/
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun main(args: Array<String>) = launch(DemoBench::class.java, *args)
|
||||
}
|
||||
|
||||
init {
|
||||
addStageIcon(Image("r3logo.png"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import java.nio.file.Paths
|
||||
class ExplorerController : Controller() {
|
||||
|
||||
private val jvm by inject<JVMConfig>()
|
||||
private val explorerPath = Paths.get("explorer", "node-explorer.jar").toAbsolutePath()
|
||||
private val explorerPath = jvm.applicationDir.resolve("explorer").resolve("node-explorer.jar")
|
||||
|
||||
init {
|
||||
log.info("Explorer JAR: " + explorerPath)
|
||||
|
@ -6,7 +6,9 @@ import tornadofx.Controller
|
||||
|
||||
class JVMConfig : Controller() {
|
||||
|
||||
val userHome: Path = Paths.get(System.getProperty("user.home")).toAbsolutePath()
|
||||
val javaPath: Path = Paths.get(System.getProperty("java.home"), "bin", "java")
|
||||
val applicationDir = Paths.get(System.getProperty("user.dir")).toAbsolutePath()
|
||||
|
||||
init {
|
||||
log.info("Java executable: " + javaPath)
|
||||
@ -21,3 +23,4 @@ class JVMConfig : Controller() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -11,17 +11,20 @@ import net.corda.demobench.pty.R3Pty
|
||||
import tornadofx.Controller
|
||||
|
||||
class NodeController : Controller() {
|
||||
companion object Data {
|
||||
private const val FIRST_PORT = 10000
|
||||
private companion object Data {
|
||||
const val FIRST_PORT = 10000
|
||||
}
|
||||
|
||||
private val baseDir = Paths.get("work", localDir).toAbsolutePath()
|
||||
private val pluginDir = Paths.get("plugins").toAbsolutePath()
|
||||
private val jvm by inject<JVMConfig>()
|
||||
|
||||
private val localDir = SimpleDateFormat("yyyyMMddHHmmss")
|
||||
.format(Date(ManagementFactory.getRuntimeMXBean().startTime))
|
||||
private val baseDir = jvm.userHome.resolve("demobench").resolve(localDir)
|
||||
private val pluginDir = jvm.applicationDir.resolve("plugins")
|
||||
|
||||
private val bankOfCorda = pluginDir.resolve("bank-of-corda.jar").toFile()
|
||||
|
||||
private val cordaPath = Paths.get("corda", "corda.jar").toAbsolutePath()
|
||||
private val cordaPath = jvm.applicationDir.resolve("corda").resolve("corda.jar")
|
||||
private val command = jvm.commandFor(cordaPath)
|
||||
|
||||
private val renderOptions = ConfigRenderOptions.defaults().setOriginComments(false)
|
||||
@ -102,8 +105,4 @@ class NodeController : Controller() {
|
||||
}
|
||||
}
|
||||
|
||||
private val localDir: String
|
||||
get() = SimpleDateFormat("yyyyMMddHHmmss")
|
||||
.format(Date(ManagementFactory.getRuntimeMXBean().startTime))
|
||||
|
||||
}
|
||||
|
@ -29,6 +29,8 @@ class NodeRPC(config: NodeConfig, invoke: (CordaRPCOps) -> Unit): AutoCloseable
|
||||
// Cancel the "setup" task now that we've created the RPC client.
|
||||
this.cancel()
|
||||
|
||||
log.info("Node '{}' is now ready.", config.legalName)
|
||||
|
||||
// Schedule a new task that will refresh the display once per second.
|
||||
timer.schedule(object: TimerTask() {
|
||||
override fun run() {
|
||||
|
@ -117,13 +117,9 @@ class NodeTerminalView : Fragment() {
|
||||
}
|
||||
|
||||
class TerminalSettingsProvider : DefaultSettingsProvider() {
|
||||
override fun getDefaultStyle(): TextStyle {
|
||||
return TextStyle(TerminalColor.WHITE, TerminalColor.BLACK)
|
||||
}
|
||||
override fun getDefaultStyle() = TextStyle(TerminalColor.WHITE, TerminalColor.BLACK)
|
||||
|
||||
override fun emulateX11CopyPaste(): Boolean {
|
||||
return true
|
||||
}
|
||||
override fun emulateX11CopyPaste() = true
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator"/>
|
||||
|
||||
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
|
||||
<file>demobench.log</file>
|
||||
<file>${user.home}/demobench.log</file>
|
||||
<append>false</append>
|
||||
<encoder>
|
||||
<pattern>%date %-5level %c{1} - %msg%n</pattern>
|
||||
|
Loading…
Reference in New Issue
Block a user