Merge branch 'master' into colljos-os-hc02-merge-121217

This commit is contained in:
josecoll 2017-12-13 10:43:01 +00:00
commit 6507f51659
7 changed files with 46 additions and 10 deletions

View File

@ -2,27 +2,34 @@
# Building the binaries # Building the binaries
## Network management server ## Network management server
To build a fat jar containing all the doorman code you can simply invoke To build a fat jar containing all the doorman code you can simply invoke:
``` ```
./gradlew network-management:capsule:buildDoormanJAR ./gradlew network-management:capsule:buildDoormanJAR
``` ```
The built file will appear in The built file will appear in:
``` ```
network-management/capsule/build/libs/doorman-<VERSION>.jar network-management/capsule/build/libs/doorman-<VERSION>.jar
``` ```
## HSM signing server ## HSM signing server
To build a fat jar containing all the HSM signer code you can simply invoke To build a fat jar containing all the HSM signer code you can simply invoke:
``` ```
./gradlew network-management:capsule-hsm:buildHsmJAR ./gradlew network-management:capsule-hsm:buildHsmJAR
``` ```
The built file will appear in The built file will appear in:
``` ```
network-management/capsule-hsm/build/libs/hsm-<VERSION>.jar network-management/capsule-hsm/build/libs/hsm-<VERSION>.jar
``` ```
The binaries can also be obtained from artifactory after deployment in teamcity The binaries can also be obtained from artifactory after deployment in TeamCity.
To run the HSM signing server:
```
cd network-management
java -jar capsule-hsm/build/libs/hsm-3.0-NETWORKMAP-20171204.134345-6-capsule.jar --configFile hsm.conf
```
#Configuring network management service #Configuring network management service
### Local signing ### Local signing

View File

@ -1,3 +1,4 @@
basedir = "."
device = "3001@127.0.0.1" device = "3001@127.0.0.1"
keyGroup = "DEV.DOORMAN" keyGroup = "DEV.DOORMAN"
keySpecifier = -1 keySpecifier = -1

View File

@ -2,6 +2,7 @@ package com.r3.corda.networkmanage.hsm
import com.r3.corda.networkmanage.common.persistence.PersistentNetworkMapStorage import com.r3.corda.networkmanage.common.persistence.PersistentNetworkMapStorage
import com.r3.corda.networkmanage.common.persistence.configureDatabase import com.r3.corda.networkmanage.common.persistence.configureDatabase
import com.r3.corda.networkmanage.common.utils.ShowHelpException
import com.r3.corda.networkmanage.hsm.authentication.AuthMode import com.r3.corda.networkmanage.hsm.authentication.AuthMode
import com.r3.corda.networkmanage.hsm.authentication.Authenticator import com.r3.corda.networkmanage.hsm.authentication.Authenticator
import com.r3.corda.networkmanage.hsm.authentication.createProvider import com.r3.corda.networkmanage.hsm.authentication.createProvider
@ -20,7 +21,12 @@ import java.security.Security
fun main(args: Array<String>) { fun main(args: Array<String>) {
try {
run(parseParameters(*args)) run(parseParameters(*args))
} catch (e: ShowHelpException) {
e.errorMessage?.let(::println)
e.parser.printHelpOn(System.out)
}
} }
fun run(parameters: Parameters) { fun run(parameters: Parameters) {

View File

@ -65,10 +65,21 @@ class Main : App(MainView::class) {
if (!isLoggedIn) { if (!isLoggedIn) {
stage.hide() stage.hide()
loginView.login() loginView.login()
addOptionalViews()
(find(primaryView) as MainView).initializeControls()
stage.show() stage.show()
} }
} }
private fun addOptionalViews() {
val iouView = find<IOUViewer>()
Models.get<CordaViewModel>(Main::class).apply {
if (iouView.isEnabledForNode()) {
registerView(iouView)
}
}
}
private fun asInteger(s: String?): Int? { private fun asInteger(s: String?): Int? {
try { try {
return s?.toInt() return s?.toInt()
@ -105,7 +116,6 @@ class Main : App(MainView::class) {
registerView<StateMachineViewer>() registerView<StateMachineViewer>()
// CordApps Views. // CordApps Views.
registerView<CashViewer>() registerView<CashViewer>()
registerView<IOUViewer>()
// Tools. // Tools.
registerView<Network>() registerView<Network>()
registerView<Settings>() registerView<Settings>()

View File

@ -11,9 +11,13 @@ class CordaViewModel {
val registeredViews = mutableListOf<CordaView>().observable() val registeredViews = mutableListOf<CordaView>().observable()
inline fun <reified T> registerView() where T : CordaView { inline fun <reified T> registerView() where T : CordaView {
registerView(find<T>())
}
fun registerView(view: CordaView) {
// Note: this is weirdly very important, as it forces the initialisation of Views. Therefore this is the entry // Note: this is weirdly very important, as it forces the initialisation of Views. Therefore this is the entry
// point to the top level observable/stream wiring! Any events sent before this init may be lost! // point to the top level observable/stream wiring! Any events sent before this init may be lost!
registeredViews.add(find<T>().apply { root }) registeredViews.add(view.apply { root })
} }
} }

View File

@ -48,7 +48,7 @@ class MainView : View(WINDOW_TITLE) {
private val menuItemArrowCSS = "sidebar-menu-item-arrow" private val menuItemArrowCSS = "sidebar-menu-item-arrow"
private val menuItemSelectedCSS = "$menuItemCSS-selected" private val menuItemSelectedCSS = "$menuItemCSS-selected"
init { fun initializeControls() {
// Header // Header
userButton.textProperty().bind(myIdentity.map { it?.let { PartyNameFormatter.short.format(it.name) } }) userButton.textProperty().bind(myIdentity.map { it?.let { PartyNameFormatter.short.format(it.name) } })
exit.setOnAction { exit.setOnAction {

View File

@ -4,7 +4,9 @@ import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon
import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView
import javafx.scene.input.MouseButton import javafx.scene.input.MouseButton
import javafx.scene.layout.BorderPane import javafx.scene.layout.BorderPane
import net.corda.core.utilities.Try
import net.corda.explorer.model.CordaView import net.corda.explorer.model.CordaView
import net.corda.explorer.model.MembershipListModel
import tornadofx.* import tornadofx.*
class IOUViewer : CordaView("IOU") { class IOUViewer : CordaView("IOU") {
@ -24,4 +26,10 @@ class IOUViewer : CordaView("IOU") {
} }
} }
} }
fun isEnabledForNode(): Boolean = Try.on {
// Assuming if the model can be initialized - the CorDapp is installed
val allParties = MembershipListModel().allParties
allParties[0]
}.isSuccess
} }