Cordformation now allows addresses to be used for non-database addresses. (#1917)

Cordformation now allows addresses to be used for non-database addresses.
This commit is contained in:
Clinton 2017-10-31 20:48:57 +00:00 committed by GitHub
parent f614557ae3
commit dcaac91691
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 18 deletions

View File

@ -254,9 +254,9 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
} }
node { node {
name "O=Bank B,OU=corda,L=London,C=GB" name "O=Bank B,OU=corda,L=London,C=GB"
p2pPort 10007 p2pAddress "localhost:10007"
rpcPort 10008 rpcAddress "localhost:10008"
webPort 10009 webAddress "localhost:10009"
cordapps = [] cordapps = []
} }
} }

View File

@ -41,11 +41,12 @@ notary node:
cordapps = [] cordapps = []
rpcUsers = [[ user: "user1", "password": "test", "permissions": []]] rpcUsers = [[ user: "user1", "password": "test", "permissions": []]]
} }
// Example of explicit addresses being used.
node { node {
name "CN=NodeC,O=NodeC,L=Paris,C=FR" name "CN=NodeC,O=NodeC,L=Paris,C=FR"
p2pPort 10011 p2pAddress "localhost:10011"
rpcPort 10012 rpcAddress "localhost:10012"
webPort 10013 webAddress "localhost:10013"
cordapps = [] cordapps = []
rpcUsers = [[ user: "user1", "password": "test", "permissions": []]] rpcUsers = [[ user: "user1", "password": "test", "permissions": []]]
} }

View File

@ -58,7 +58,16 @@ public class CordformNode implements NodeDefinition {
} }
/** /**
* Set the Artemis P2P port for this node. * Get the artemis address for this node.
*
* @return This node's P2P address.
*/
public String getP2pAddress() {
return config.getString("p2pAddress");
}
/**
* Set the Artemis P2P port for this node on localhost.
* *
* @param p2pPort The Artemis messaging queue port. * @param p2pPort The Artemis messaging queue port.
*/ */
@ -67,7 +76,16 @@ public class CordformNode implements NodeDefinition {
} }
/** /**
* Set the Artemis RPC port for this node. * Set the Artemis P2P address for this node.
*
* @param p2pAddress The Artemis messaging queue host and port.
*/
public void p2pAddress(String p2pAddress) {
config = config.withValue("p2pAddress", ConfigValueFactory.fromAnyRef(p2pAddress));
}
/**
* Set the Artemis RPC port for this node on localhost.
* *
* @param rpcPort The Artemis RPC queue port. * @param rpcPort The Artemis RPC queue port.
*/ */
@ -75,6 +93,15 @@ public class CordformNode implements NodeDefinition {
config = config.withValue("rpcAddress", ConfigValueFactory.fromAnyRef(DEFAULT_HOST + ':' + rpcPort)); config = config.withValue("rpcAddress", ConfigValueFactory.fromAnyRef(DEFAULT_HOST + ':' + rpcPort));
} }
/**
* Set the Artemis RPC address for this node.
*
* @param rpcAddress The Artemis RPC queue host and port.
*/
public void rpcAddress(String rpcAddress) {
config = config.withValue("rpcAddress", ConfigValueFactory.fromAnyRef(rpcAddress));
}
/** /**
* Set the path to a file with optional properties, which are appended to the generated node.conf file. * Set the path to a file with optional properties, which are appended to the generated node.conf file.
* *

View File

@ -61,7 +61,7 @@ class Node(private val project: Project) : CordformNode() {
} }
/** /**
* Set the HTTP web server port for this node. * Set the HTTP web server port for this node. Will use localhost as the address.
* *
* @param webPort The web port number for this node. * @param webPort The web port number for this node.
*/ */
@ -70,6 +70,16 @@ class Node(private val project: Project) : CordformNode() {
ConfigValueFactory.fromAnyRef("$DEFAULT_HOST:$webPort")) ConfigValueFactory.fromAnyRef("$DEFAULT_HOST:$webPort"))
} }
/**
* Set the HTTP web server address and port for this node.
*
* @param webAddress The web address for this node.
*/
fun webAddress(webAddress: String) {
config = config.withValue("webAddress",
ConfigValueFactory.fromAnyRef(webAddress))
}
/** /**
* Set the network map address for this node. * Set the network map address for this node.
* *
@ -107,15 +117,6 @@ class Node(private val project: Project) : CordformNode() {
appendOptionalConfig() appendOptionalConfig()
} }
/**
* Get the artemis address for this node.
*
* @return This node's P2P address.
*/
fun getP2PAddress(): String {
return config.getString("p2pAddress")
}
internal fun rootDir(rootDir: Path) { internal fun rootDir(rootDir: Path) {
if(name == null) { if(name == null) {
project.logger.error("Node has a null name - cannot create node") project.logger.error("Node has a null name - cannot create node")