mirror of
https://github.com/corda/corda.git
synced 2025-06-01 23:20:54 +00:00
Fixed review comments.
This commit is contained in:
parent
f46cbd32c6
commit
f2a93ea67b
@ -1,4 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
# Creates three nodes. A network map and notary node and two regular nodes that can be extended with cordapps.
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
trap 'kill $(jobs -p)' SIGINT SIGTERM EXIT
|
trap 'kill $(jobs -p)' SIGINT SIGTERM EXIT
|
||||||
export CAPSULE_CACHE_DIR=cache
|
export CAPSULE_CACHE_DIR=cache
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
Creating a Cordapp
|
Creating a Cordapp
|
||||||
==================
|
==================
|
||||||
|
|
||||||
A Cordapp is an application that runs on the Corda platform using Corda APIs and plugin system. Cordapps are self
|
A Cordapp is an application that runs on the Corda platform using the platform APIs and plugin system. They are self
|
||||||
contained in separate JARs from the Corda node server JAR that are created and distributed.
|
contained in separate JARs from the node server JAR that are created and distributed.
|
||||||
|
|
||||||
App Plugins
|
App Plugins
|
||||||
-----------
|
-----------
|
||||||
@ -12,10 +12,6 @@ App Plugins
|
|||||||
To create an app plugin you must you must extend from `CordaPluginRegistry`_. The JavaDoc contains
|
To create an app plugin you must you must extend from `CordaPluginRegistry`_. The JavaDoc contains
|
||||||
specific details of the implementation, but you can extend the server in the following ways:
|
specific details of the implementation, but you can extend the server in the following ways:
|
||||||
|
|
||||||
.. _CordaPluginRegistry: api/com.r3corda.core.node/-corda-plugin-registry/index.html
|
|
||||||
.. _ServiceHubInternal: api/com.r3corda.node.services.api/-service-hub-internal/index.html
|
|
||||||
.. _ServiceHub: api/com.r3corda.node.services.api/-service-hub/index.html
|
|
||||||
|
|
||||||
1. Required protocols: Specify which protocols will be whitelisted for use in your web APIs.
|
1. Required protocols: Specify which protocols will be whitelisted for use in your web APIs.
|
||||||
2. Service plugins: Register your :ref:`services`.
|
2. Service plugins: Register your :ref:`services`.
|
||||||
3. Web APIs: You may register your own endpoints under /api/ of the built-in web server.
|
3. Web APIs: You may register your own endpoints under /api/ of the built-in web server.
|
||||||
@ -27,8 +23,8 @@ Services
|
|||||||
.. _services:
|
.. _services:
|
||||||
|
|
||||||
Services are classes which are constructed after the node has started. It is provided a `ServiceHubInternal`_ which
|
Services are classes which are constructed after the node has started. It is provided a `ServiceHubInternal`_ which
|
||||||
allows a more rich API than the `ServiceHub`_ exposed to contracts. It enables adding protocols, registering
|
allows a richer API than the `ServiceHub`_ exposed to contracts. It enables adding protocols, registering
|
||||||
message handlers and more. The service does not run in a thread, the only entry point to the service is during
|
message handlers and more. The service does not run in a separate thread, so the only entry point to the service is during
|
||||||
construction, where message handlers should be registered and threads started.
|
construction, where message handlers should be registered and threads started.
|
||||||
|
|
||||||
|
|
||||||
@ -38,7 +34,7 @@ Starting Nodes
|
|||||||
To use an app you must also have a node server. To create a node server run the gradle installTemplateNodes task.
|
To use an app you must also have a node server. To create a node server run the gradle installTemplateNodes task.
|
||||||
|
|
||||||
This will output the node JAR to ``build/libs/corda.jar`` and several sample/standard
|
This will output the node JAR to ``build/libs/corda.jar`` and several sample/standard
|
||||||
node servers to ``build/nodes``. For now you can use the ``build/nodes/nodea`` configuration as a template.
|
node setups to ``build/nodes``. For now you can use the ``build/nodes/nodea`` configuration as a template.
|
||||||
|
|
||||||
Each node server must have a ``node.conf`` file in the same directory as the node JAR file. After first
|
Each node server must have a ``node.conf`` file in the same directory as the node JAR file. After first
|
||||||
execution of the node server there will be many other configuration and persistence files created in this directory.
|
execution of the node server there will be many other configuration and persistence files created in this directory.
|
||||||
@ -56,7 +52,7 @@ case the ``node_dir`` is the location where your node server's JAR and configura
|
|||||||
Starting your Node
|
Starting your Node
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
Now you have a node server with your Cordapp installed, you can run it by navigating to ``<node_dir>`` and running
|
Now you have a node server with your app installed, you can run it by navigating to ``<node_dir>`` and running
|
||||||
|
|
||||||
java -jar corda.jar
|
java -jar corda.jar
|
||||||
|
|
||||||
@ -64,3 +60,6 @@ The plugin should automatically be registered and the configuration file used.
|
|||||||
|
|
||||||
.. warning:: If your working directory is not ``<node_dir>`` your plugins and configuration will not be used.
|
.. warning:: If your working directory is not ``<node_dir>`` your plugins and configuration will not be used.
|
||||||
|
|
||||||
|
.. _CordaPluginRegistry: api/com.r3corda.core.node/-corda-plugin-registry/index.html
|
||||||
|
.. _ServiceHubInternal: api/com.r3corda.node.services.api/-service-hub-internal/index.html
|
||||||
|
.. _ServiceHub: api/com.r3corda.node.services.api/-service-hub/index.html
|
@ -21,6 +21,8 @@ public class CordaCaplet extends Capsule {
|
|||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
protected <T> T attribute(Map.Entry<String, T> attr) {
|
protected <T> T attribute(Map.Entry<String, T> attr) {
|
||||||
|
// Equality is used here because Capsule never instantiates these attributes but instead reuses the ones
|
||||||
|
// defined as public static final fields on the Capsule class, therefore referential equality is safe.
|
||||||
if(ATTR_APP_CLASS_PATH == attr) {
|
if(ATTR_APP_CLASS_PATH == attr) {
|
||||||
T cp = super.attribute(attr);
|
T cp = super.attribute(attr);
|
||||||
List<Path> classpath = (List<Path>) cp;
|
List<Path> classpath = (List<Path>) cp;
|
||||||
@ -47,7 +49,6 @@ public class CordaCaplet extends Capsule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Boolean isJAR(File file) {
|
private Boolean isJAR(File file) {
|
||||||
String[] parts = file.getName().split("\\.");
|
return file.getName().toLowerCase().endsWith(".jar");
|
||||||
return (parts.length > 1) && (parts[parts.length - 1].toLowerCase().equals("jar"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user