public class AbstractNode
extends SingletonSerializeAsToken
A base node implementation that can be customised either for production (with real implementations that do real I/O), or a mock implementation suitable for unit test environments.
Marked as SingletonSerializeAsToken to prevent the invisible reference to AbstractNode in the ServiceHub accidentally sweeping up the Node into the Kryo checkpoint serialization via any flows holding a reference to ServiceHub.
Modifier and Type | Field and Description |
---|---|
NodeAttachmentService |
attachments |
CheckpointStorage |
checkpointStorage |
CordaPersistence |
database |
NodeInfo |
info |
MessagingService |
network |
StateMachineManager |
smm |
Constructor and Description |
---|
AbstractNode(NodeConfiguration configuration,
java.util.Set<net.corda.core.node.services.ServiceInfo> advertisedServices,
java.time.Clock platformClock,
org.apache.activemq.artemis.utils.ReusableLatch busyNodeLatch)
A base node implementation that can be customised either for production (with real implementations that do real
I/O), or a mock implementation suitable for unit test environments.
|
Modifier and Type | Method and Description |
---|---|
int |
acceptableLiveFiberCountOnStop() |
WorldMapLocation |
findMyLocation() |
java.security.KeyPair |
generateKeyPair() |
java.util.Set<net.corda.core.node.services.ServiceInfo> |
getAdvertisedServices() |
NodeAttachmentService |
getAttachments() |
org.apache.activemq.artemis.utils.ReusableLatch |
getBusyNodeLatch() |
CheckpointStorage |
getCheckpointStorage() |
NodeConfiguration |
getConfiguration() |
CordaPersistence |
getDatabase() |
kotlin.jvm.functions.Function0<java.lang.Object> |
getDbCloser() |
NetworkMapService |
getInNodeNetworkMapService() |
NodeInfo |
getInfo() |
org.slf4j.Logger |
getLog() |
MessagingService |
getNetwork() |
SingleMessageRecipient |
getNetworkMapAddress() |
com.google.common.util.concurrent.ListenableFuture<kotlin.Unit> |
getNetworkMapRegistrationFuture()
Completes once the node has successfully registered with the network map service
|
long |
getNetworkMapSeq()
Sequence number of changes sent to the network map service, when registering/de-registering this node.
|
java.util.Set<java.security.KeyPair> |
getPartyKeys() |
java.time.Clock |
getPlatformClock() |
int |
getPlatformVersion() |
java.util.List<net.corda.core.node.CordaPluginRegistry> |
getPluginRegistries()
Fetch CordaPluginRegistry classes registered in META-INF/services/net.corda.core.node.CordaPluginRegistry files that exist in the classpath
|
CordaRPCOps |
getRpcOps()
The implementation of the
interface CordaRPCOps interface used by this node. |
java.util.ArrayList<kotlin.jvm.functions.Function0> |
getRunOnStop() |
AffinityExecutor |
getServerThread() |
ServiceHubInternal |
getServices() |
StateMachineManager |
getSmm() |
boolean |
getStarted()
Set to true once
AbstractNode.start has been successfully called. |
com.google.common.util.concurrent.SettableFuture<kotlin.Unit> |
get_networkMapRegistrationFuture() |
void |
initialiseDatabasePersistence(kotlin.jvm.functions.Function0<kotlin.Unit> insideTransaction) |
<T extends SerializeAsToken> |
installCordaService(java.lang.Class<T> serviceClass)
Use this method to install your Corda services in your tests. This is automatically done by the node when it
starts up for all classes it finds which are annotated with
interface CordaService . |
<F extends FlowLogic<?>> |
internalRegisterFlowFactory(java.lang.Class<? extends net.corda.core.flows.FlowLogic<?>> initiatingFlowClass,
InitiatedFlowFactory<? extends F> flowFactory,
java.lang.Class<F> initiatedFlowClass,
boolean track) |
boolean |
isPreviousCheckpointsPresent() |
void |
makeCoreNotaryService(ServiceType type,
java.util.List<java.lang.Object> tokenizableServices) |
IdentityService |
makeIdentityService(java.security.cert.X509Certificate trustRoot,
CertificateAndKeyPair clientCa,
PartyAndCertificate legalIdentity) |
KeyManagementService |
makeKeyManagementService(IdentityService identityService) |
MessagingService |
makeMessagingService() |
void |
makeNetworkMapService() |
java.util.List<net.corda.core.node.ServiceEntry> |
makeServiceEntries()
A service entry contains the advertised
class ServiceInfo along with the service identity. The identity name is
taken from the configuration or, if non specified, generated by combining the node's legal name and the service id. |
WritableTransactionStorage |
makeTransactionStorage() |
TransactionVerifierService |
makeTransactionVerifierService() |
java.util.List<net.corda.core.utilities.NetworkHostAndPort> |
myAddresses()
Return list of node's addresses. It's overridden in MockNetwork as we don't have real addresses for MockNodes.
|
com.google.common.util.concurrent.ListenableFuture<kotlin.Unit> |
noNetworkMapConfigured()
This is overriden by the mock node implementation to enable operation without any network map service
|
PartyAndCertificate |
obtainLegalIdentity() |
java.security.KeyPair |
obtainLegalIdentityKey() |
<T extends FlowLogic<?>> |
registerInitiatedFlow(java.lang.Class<T> initiatedFlowClass)
Use this method to register your initiated flows in your tests. This is automatically done by the node when it
starts up for all
class FlowLogic classes it finds which are annotated with interface InitiatedBy . |
com.google.common.util.concurrent.ListenableFuture<kotlin.Unit> |
registerWithNetworkMap()
Register this node with the network map cache, and load network map from a remote service (and register for
updates) if one has been supplied.
|
void |
setAttachments(NodeAttachmentService p) |
void |
setCheckpointStorage(CheckpointStorage p) |
void |
setDatabase(CordaPersistence p) |
void |
setDbCloser(kotlin.jvm.functions.Function0<? extends java.lang.Object> p) |
void |
setInNodeNetworkMapService(NetworkMapService p) |
void |
setInfo(NodeInfo p) |
void |
setNetwork(MessagingService p) |
void |
setNetworkMapSeq(long p)
Sequence number of changes sent to the network map service, when registering/de-registering this node.
|
void |
setSmm(StateMachineManager p) |
void |
start() |
void |
startMessagingService(RPCOps rpcOps) |
void |
stop() |
toToken
toToken
public NodeInfo info
public CheckpointStorage checkpointStorage
public StateMachineManager smm
public NodeAttachmentService attachments
public MessagingService network
public CordaPersistence database
public AbstractNode(NodeConfiguration configuration, java.util.Set<net.corda.core.node.services.ServiceInfo> advertisedServices, java.time.Clock platformClock, org.apache.activemq.artemis.utils.ReusableLatch busyNodeLatch)
A base node implementation that can be customised either for production (with real implementations that do real I/O), or a mock implementation suitable for unit test environments.
Marked as SingletonSerializeAsToken to prevent the invisible reference to AbstractNode in the ServiceHub accidentally sweeping up the Node into the Kryo checkpoint serialization via any flows holding a reference to ServiceHub.
public long getNetworkMapSeq()
Sequence number of changes sent to the network map service, when registering/de-registering this node.
public void setNetworkMapSeq(long p)
Sequence number of changes sent to the network map service, when registering/de-registering this node.
public org.slf4j.Logger getLog()
public SingleMessageRecipient getNetworkMapAddress()
public int getPlatformVersion()
public AffinityExecutor getServerThread()
public java.util.Set<java.security.KeyPair> getPartyKeys()
public ServiceHubInternal getServices()
public NodeInfo getInfo()
public void setInfo(NodeInfo p)
public CheckpointStorage getCheckpointStorage()
public void setCheckpointStorage(CheckpointStorage p)
public StateMachineManager getSmm()
public void setSmm(StateMachineManager p)
public NodeAttachmentService getAttachments()
public void setAttachments(NodeAttachmentService p)
public NetworkMapService getInNodeNetworkMapService()
public void setInNodeNetworkMapService(NetworkMapService p)
public MessagingService getNetwork()
public void setNetwork(MessagingService p)
public java.util.ArrayList<kotlin.jvm.functions.Function0> getRunOnStop()
public CordaPersistence getDatabase()
public void setDatabase(CordaPersistence p)
public kotlin.jvm.functions.Function0<java.lang.Object> getDbCloser()
public void setDbCloser(kotlin.jvm.functions.Function0<? extends java.lang.Object> p)
public boolean isPreviousCheckpointsPresent()
public com.google.common.util.concurrent.SettableFuture<kotlin.Unit> get_networkMapRegistrationFuture()
public com.google.common.util.concurrent.ListenableFuture<kotlin.Unit> getNetworkMapRegistrationFuture()
Completes once the node has successfully registered with the network map service
public java.util.List<net.corda.core.node.CordaPluginRegistry> getPluginRegistries()
Fetch CordaPluginRegistry classes registered in META-INF/services/net.corda.core.node.CordaPluginRegistry files that exist in the classpath
public boolean getStarted()
Set to true once AbstractNode.start
has been successfully called.
AbstractNode.start
public CordaRPCOps getRpcOps()
The implementation of the interface CordaRPCOps
interface used by this node.
interface CordaRPCOps
public WorldMapLocation findMyLocation()
public void start()
public <T extends SerializeAsToken> T installCordaService(java.lang.Class<T> serviceClass)
Use this method to install your Corda services in your tests. This is automatically done by the node when it
starts up for all classes it finds which are annotated with interface CordaService
.
interface CordaService
public <T extends FlowLogic<?>> rx.Observable<T> registerInitiatedFlow(java.lang.Class<T> initiatedFlowClass)
Use this method to register your initiated flows in your tests. This is automatically done by the node when it
starts up for all class FlowLogic
classes it finds which are annotated with interface InitiatedBy
.
class FlowLogic
,
interface InitiatedBy
public <F extends FlowLogic<?>> rx.Observable<F> internalRegisterFlowFactory(java.lang.Class<? extends net.corda.core.flows.FlowLogic<?>> initiatingFlowClass, InitiatedFlowFactory<? extends F> flowFactory, java.lang.Class<F> initiatedFlowClass, boolean track)
public WritableTransactionStorage makeTransactionStorage()
public java.util.List<net.corda.core.node.ServiceEntry> makeServiceEntries()
A service entry contains the advertised class ServiceInfo
along with the service identity. The identity name is
taken from the configuration or, if non specified, generated by combining the node's legal name and the service id.
class ServiceInfo
public int acceptableLiveFiberCountOnStop()
public void initialiseDatabasePersistence(kotlin.jvm.functions.Function0<kotlin.Unit> insideTransaction)
public com.google.common.util.concurrent.ListenableFuture<kotlin.Unit> registerWithNetworkMap()
Register this node with the network map cache, and load network map from a remote service (and register for updates) if one has been supplied.
public java.util.List<net.corda.core.utilities.NetworkHostAndPort> myAddresses()
Return list of node's addresses. It's overridden in MockNetwork as we don't have real addresses for MockNodes.
public com.google.common.util.concurrent.ListenableFuture<kotlin.Unit> noNetworkMapConfigured()
This is overriden by the mock node implementation to enable operation without any network map service
public KeyManagementService makeKeyManagementService(IdentityService identityService)
public void makeNetworkMapService()
public void makeCoreNotaryService(ServiceType type, java.util.List<java.lang.Object> tokenizableServices)
public IdentityService makeIdentityService(java.security.cert.X509Certificate trustRoot, CertificateAndKeyPair clientCa, PartyAndCertificate legalIdentity)
public TransactionVerifierService makeTransactionVerifierService()
public void stop()
public MessagingService makeMessagingService()
public void startMessagingService(RPCOps rpcOps)
public PartyAndCertificate obtainLegalIdentity()
public java.security.KeyPair obtainLegalIdentityKey()
public java.security.KeyPair generateKeyPair()
public NodeConfiguration getConfiguration()
public java.util.Set<net.corda.core.node.services.ServiceInfo> getAdvertisedServices()
public java.time.Clock getPlatformClock()
public org.apache.activemq.artemis.utils.ReusableLatch getBusyNodeLatch()