net.corda.node.internal

## Class AbstractNode

- SingletonSerializeAsToken
- - net.corda.node.internal.AbstractNode

- All Implemented Interfaces:
    SerializeAsToken
  Direct Known Subclasses:
    Node

      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.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `AbstractNode.Companion`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static AbstractNode.Companion` | `Companion`
    `CheckpointStorage` | `checkpointStorage`
    `org.jetbrains.exposed.sql.Database` | `database`
    `FlowLogicRefFactory` | `flowLogicFactory`
    `IdentityService` | `identity`
    `NodeInfo` | `info`
    `KeyManagementService` | `keyManagement`
    `MessagingServiceInternal` | `net`
    `NetworkMapCache` | `netMapCache`
    `NodeSchedulerService` | `scheduler`
    `SchemaService` | `schemas`
    `StateMachineManager` | `smm`
    `TxWritableStorageService` | `storage`
    `VaultService` | `vault`

  - ### Constructor Summary

    Constructors
    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.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `acceptableLiveFiberCountOnStop()`
    `StorageServiceImpl` | `constructStorageService(NodeAttachmentService attachments, TransactionStorage transactionStorage, StateMachineRecordedTransactionMappingStorage stateMachineRecordedTransactionMappingStorage)`
    `void` | `createNodeDir()`
    `PhysicalLocation` | `findMyLocation()`
    `java.security.KeyPair` | `generateKeyPair()`
    `java.util.Set<net.corda.core.node.services.ServiceInfo>` | `getAdvertisedServices()`
    `org.apache.activemq.artemis.utils.ReusableLatch` | `getBusyNodeLatch()`
    `CheckpointStorage` | `getCheckpointStorage()`
    `NodeConfiguration` | `getConfiguration()`
    `java.util.ArrayList<java.lang.Object>` | `getCustomServices()`
    `org.jetbrains.exposed.sql.Database` | `getDatabase()`
    `java.lang.Runnable` | `getDbCloser()`
    `FlowLogicRefFactory` | `getFlowLogicFactory()`
    `IdentityService` | `getIdentity()`
    `NetworkMapService` | `getInNodeNetworkMapService()`
    `NotaryService` | `getInNodeNotaryService()`
    `NodeInfo` | `getInfo()`
    `KeyManagementService` | `getKeyManagement()`
    `org.slf4j.Logger` | `getLog()`
    `MessagingServiceInternal` | `getNet()`
    `NetworkMapCache` | `getNetMapCache()`
    `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()`
    `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
    `java.util.ArrayList<java.lang.Runnable>` | `getRunOnStop()`
    `NodeSchedulerService` | `getScheduler()`
    `SchemaService` | `getSchemas()`
    `AffinityExecutor` | `getServerThread()`
    `ServiceHubInternal` | `getServices()`
    `StateMachineManager` | `getSmm()`
    `boolean` | `getStarted()` Set to true once `AbstractNode.start` has been successfully called.
    `TxWritableStorageService` | `getStorage()`
    `VaultService` | `getVault()`
    `com.google.common.util.concurrent.SettableFuture<kotlin.Unit>` | `get_networkMapRegistrationFuture()`
    `void` | `initialiseDatabasePersistence(kotlin.jvm.functions.Function0<kotlin.Unit> insideTransaction)`
    `kotlin.Pair<net.corda.core.node.services.TxWritableStorageService,net.corda.node.services.api.CheckpointStorage>` | `initialiseStorageService(java.nio.file.Path dir)`
    `boolean` | `isPreviousCheckpointsPresent()`
    `NodeAttachmentService` | `makeAttachmentStorage(java.nio.file.Path dir)`
    `IdentityService` | `makeIdentityService()`
    `KeyManagementService` | `makeKeyManagementService()`
    `MessagingServiceInternal` | `makeMessagingService()`
    `void` | `makeNetworkMapService()`
    `NotaryService` | `makeNotaryService(ServiceType type, java.util.List<java.lang.Object> tokenizableServices)`
    `SchemaService` | `makeSchemaService()`
    `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.
    `UniquenessProvider` | `makeUniquenessProvider(ServiceType type)`
    `VaultService` | `makeVaultService(java.util.Properties dataSourceProperties)`
    `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
    `Party` | `obtainLegalIdentity()`
    `java.security.KeyPair` | `obtainLegalIdentityKey()`
    `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` | `setCheckpointStorage(CheckpointStorage p)`
    `void` | `setDatabase(org.jetbrains.exposed.sql.Database p)`
    `void` | `setDbCloser(java.lang.Runnable p)`
    `void` | `setFlowLogicFactory(FlowLogicRefFactory p)`
    `void` | `setIdentity(IdentityService p)`
    `void` | `setInNodeNetworkMapService(NetworkMapService p)`
    `void` | `setInNodeNotaryService(NotaryService p)`
    `void` | `setInfo(NodeInfo p)`
    `void` | `setKeyManagement(KeyManagementService p)`
    `void` | `setNet(MessagingServiceInternal p)`
    `void` | `setNetMapCache(NetworkMapCache p)`
    `void` | `setNetworkMapSeq(long p)` Sequence number of changes sent to the network map service, when registering/de-registering this node.
    `void` | `setScheduler(NodeSchedulerService p)`
    `void` | `setSchemas(SchemaService p)`
    `void` | `setSmm(StateMachineManager p)`
    `void` | `setStorage(TxWritableStorageService p)`
    `void` | `setVault(VaultService p)`
    `AbstractNode` | `setup()` Run any tasks that are needed to ensure the node is in a correct state before running start().
    `AbstractNode` | `start()`
    `void` | `startMessagingService(RPCOps rpcOps)`
    `void` | `stop()`

    - ### Methods inherited from class net.corda.core.serialization.SingletonSerializeAsToken

      `toToken`

    - ### Methods inherited from interface net.corda.core.serialization.SerializeAsToken

      `toToken`

- - ### Field Detail

    - #### info

          public NodeInfo info

    - #### storage

          public TxWritableStorageService storage

    - #### checkpointStorage

          public CheckpointStorage checkpointStorage

    - #### smm

          public StateMachineManager smm

    - #### vault

          public VaultService vault

    - #### keyManagement

          public KeyManagementService keyManagement

    - #### identity

          public IdentityService identity

    - #### net

          public MessagingServiceInternal net

    - #### netMapCache

          public NetworkMapCache netMapCache

    - #### scheduler

          public NodeSchedulerService scheduler

    - #### flowLogicFactory

          public FlowLogicRefFactory flowLogicFactory

    - #### schemas

          public SchemaService schemas

    - #### database

          public org.jetbrains.exposed.sql.Database database

    - #### Companion

          public static AbstractNode.Companion Companion

  - ### Constructor Detail

    - #### AbstractNode

          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.

  - ### Method Detail

    - #### getNetworkMapSeq

          public long getNetworkMapSeq()

      Sequence number of changes sent to the network map service, when registering/de-registering this node.

    - #### setNetworkMapSeq

          public void setNetworkMapSeq(long p)

      Sequence number of changes sent to the network map service, when registering/de-registering this node.

    - #### getLog

          public org.slf4j.Logger getLog()

    - #### getNetworkMapAddress

          public SingleMessageRecipient getNetworkMapAddress()

    - #### getServerThread

          public AffinityExecutor getServerThread()

    - #### getPartyKeys

          public java.util.Set<java.security.KeyPair> getPartyKeys()

    - #### getServices

          public ServiceHubInternal getServices()

    - #### findMyLocation

          public PhysicalLocation findMyLocation()

    - #### getInfo

          public NodeInfo getInfo()

    - #### setInfo

          public void setInfo(NodeInfo p)

    - #### getStorage

          public TxWritableStorageService getStorage()

    - #### setStorage

          public void setStorage(TxWritableStorageService p)

    - #### getCheckpointStorage

          public CheckpointStorage getCheckpointStorage()

    - #### setCheckpointStorage

          public void setCheckpointStorage(CheckpointStorage p)

    - #### getSmm

          public StateMachineManager getSmm()

    - #### setSmm

          public void setSmm(StateMachineManager p)

    - #### getVault

          public VaultService getVault()

    - #### setVault

          public void setVault(VaultService p)

    - #### getKeyManagement

          public KeyManagementService getKeyManagement()

    - #### setKeyManagement

          public void setKeyManagement(KeyManagementService p)

    - #### getInNodeNetworkMapService

          public NetworkMapService getInNodeNetworkMapService()

    - #### setInNodeNetworkMapService

          public void setInNodeNetworkMapService(NetworkMapService p)

    - #### getInNodeNotaryService

          public NotaryService getInNodeNotaryService()

    - #### setInNodeNotaryService

          public void setInNodeNotaryService(NotaryService p)

    - #### getIdentity

          public IdentityService getIdentity()

    - #### setIdentity

          public void setIdentity(IdentityService p)

    - #### getNet

          public MessagingServiceInternal getNet()

    - #### setNet

          public void setNet(MessagingServiceInternal p)

    - #### getNetMapCache

          public NetworkMapCache getNetMapCache()

    - #### setNetMapCache

          public void setNetMapCache(NetworkMapCache p)

    - #### getScheduler

          public NodeSchedulerService getScheduler()

    - #### setScheduler

          public void setScheduler(NodeSchedulerService p)

    - #### getFlowLogicFactory

          public FlowLogicRefFactory getFlowLogicFactory()

    - #### setFlowLogicFactory

          public void setFlowLogicFactory(FlowLogicRefFactory p)

    - #### getSchemas

          public SchemaService getSchemas()

    - #### setSchemas

          public void setSchemas(SchemaService p)

    - #### getCustomServices

          public java.util.ArrayList<java.lang.Object> getCustomServices()

    - #### getRunOnStop

          public java.util.ArrayList<java.lang.Runnable> getRunOnStop()

    - #### getDatabase

          public org.jetbrains.exposed.sql.Database getDatabase()

    - #### setDatabase

          public void setDatabase(org.jetbrains.exposed.sql.Database p)

    - #### getDbCloser

          public java.lang.Runnable getDbCloser()

    - #### setDbCloser

          public void setDbCloser(java.lang.Runnable p)

    - #### isPreviousCheckpointsPresent

          public boolean isPreviousCheckpointsPresent()

    - #### get_networkMapRegistrationFuture

          public com.google.common.util.concurrent.SettableFuture<kotlin.Unit> get_networkMapRegistrationFuture()

    - #### getNetworkMapRegistrationFuture

          public com.google.common.util.concurrent.ListenableFuture<kotlin.Unit> getNetworkMapRegistrationFuture()

      Completes once the node has successfully registered with the network map service

    - #### getPluginRegistries

          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

    - #### getStarted

          public boolean getStarted()

      Set to true once `AbstractNode.start` has been successfully called.

      See Also:
        `AbstractNode.start`

    - #### start

          public AbstractNode start()

    - #### makeServiceEntries

          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.

      See Also:
        `class ServiceInfo`

    - #### acceptableLiveFiberCountOnStop

          public int acceptableLiveFiberCountOnStop()

    - #### initialiseDatabasePersistence

          public void initialiseDatabasePersistence(kotlin.jvm.functions.Function0<kotlin.Unit> insideTransaction)

    - #### setup

          public AbstractNode setup()

      Run any tasks that are needed to ensure the node is in a correct state before running start().

    - #### registerWithNetworkMap

          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.

    - #### noNetworkMapConfigured

          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

    - #### makeKeyManagementService

          public KeyManagementService makeKeyManagementService()

    - #### makeNetworkMapService

          public void makeNetworkMapService()

    - #### makeNotaryService

          public NotaryService makeNotaryService(ServiceType type,
                                                 java.util.List<java.lang.Object> tokenizableServices)

    - #### makeUniquenessProvider

          public UniquenessProvider makeUniquenessProvider(ServiceType type)

    - #### makeIdentityService

          public IdentityService makeIdentityService()

    - #### makeVaultService

          public VaultService makeVaultService(java.util.Properties dataSourceProperties)

    - #### makeSchemaService

          public SchemaService makeSchemaService()

    - #### stop

          public void stop()

    - #### makeMessagingService

          public MessagingServiceInternal makeMessagingService()

    - #### startMessagingService

          public void startMessagingService(RPCOps rpcOps)

    - #### initialiseStorageService

          public kotlin.Pair<net.corda.core.node.services.TxWritableStorageService,net.corda.node.services.api.CheckpointStorage> initialiseStorageService(java.nio.file.Path dir)

    - #### constructStorageService

          public StorageServiceImpl constructStorageService(NodeAttachmentService attachments,
                                                            TransactionStorage transactionStorage,
                                                            StateMachineRecordedTransactionMappingStorage stateMachineRecordedTransactionMappingStorage)

    - #### obtainLegalIdentity

          public Party obtainLegalIdentity()

    - #### obtainLegalIdentityKey

          public java.security.KeyPair obtainLegalIdentityKey()

    - #### generateKeyPair

          public java.security.KeyPair generateKeyPair()

    - #### makeAttachmentStorage

          public NodeAttachmentService makeAttachmentStorage(java.nio.file.Path dir)

    - #### createNodeDir

          public void createNodeDir()

    - #### getConfiguration

          public NodeConfiguration getConfiguration()

    - #### getAdvertisedServices

          public java.util.Set<net.corda.core.node.services.ServiceInfo> getAdvertisedServices()

    - #### getPlatformClock

          public java.time.Clock getPlatformClock()

    - #### getBusyNodeLatch

          public org.apache.activemq.artemis.utils.ReusableLatch getBusyNodeLatch()