corda / com.r3.corda.networkmanage.common.utils

Package com.r3.corda.networkmanage.common.utils

Types

BaseCommand

abstract class BaseCommand : Runnable

BaseServiceCommand

abstract class BaseServiceCommand : BaseCommand

ConfigFilePathArgsParser

open class ConfigFilePathArgsParser : Validated

CrlUtilsTest

class CrlUtilsTest

ExponentialBackOffTimer

class ExponentialBackOffTimer : Timer

Extension of the Java Timer util class that schedules tasks with exponential backoff, as well as the ability to cancel the currently running task as well as future scheduled tasks. It also enables asynchronous cancellation

HsmX509UtilitiesTest

class HsmX509UtilitiesTest

IllegalCommandLineArgument

open class IllegalCommandLineArgument

IllegalSeedArgument

class IllegalSeedArgument : IllegalCommandLineArgument

KeystoreFilePathArgsParser

class KeystoreFilePathArgsParser

LoggingLevelConverter

class LoggingLevelConverter

NetworkManagerCommandExceptionHandler

class NetworkManagerCommandExceptionHandler<R>

This class inherits the core functionality of the DefaultExceptionHandler provided by picocli, with a few tweaks. When a return code on error is specified, the DefaultExceptionHandler has the exception's stacktrace printed to console instead of being rethrown, causing our NetworkServicesUncaughtExceptionHandler to not catch anything and the console output to be incorrect.

NetworkServicesErrorWithCode

class NetworkServicesErrorWithCode

NetworkServicesUncaughtExceptionHandler

class NetworkServicesUncaughtExceptionHandler : UncaughtExceptionHandler

Revocation

data class Revocation

ServiceCommand

abstract class ServiceCommand : BaseServiceCommand

SupportedCrlReasons

enum class SupportedCrlReasons

UtilsTest

class UtilsTest

Validated

interface Validated

VersionProvider

class VersionProvider

Custom version printing when command is called with --version or -V flag.

WorkingDirConfigFilePathArgsParser

class WorkingDirConfigFilePathArgsParser : ConfigFilePathArgsParser

Extensions for External Classes

java.time.Duration

kotlin.collections.Iterable

Properties

CORDA_NETWORK_MAP

const val CORDA_NETWORK_MAP: String

DUMMY_CERTIFICATE_REVOCATION

val DUMMY_CERTIFICATE_REVOCATION: Revocation

NETWORK_ROOT_TRUSTSTORE_FILENAME

const val NETWORK_ROOT_TRUSTSTORE_FILENAME: String

Functions

buildCertChainForHSM

fun buildCertChainForHSM(certificateAlias: String, keyStore: KeyStore, certificatesStores: Collection<<ERROR CLASS>>, ctx: <ERROR CLASS>): List<X509Certificate>

The method assumes that the certificates store has been built using the HSM. In this case, as certificate chains larger than 1 are not supported, the key store should always contain the initial certificate. There are two scenarios:

fun buildCertChainForHSM(certificateAlias: String, keyStore: KeyStore, certificatesStore: <ERROR CLASS>?, ctx: <ERROR CLASS>): List<X509Certificate>

Overload for the buildCertChainForLocal

buildCertChainForLocal

fun buildCertChainForLocal(certificateAlias: String, certificatesStores: Collection<<ERROR CLASS>>, ctx: <ERROR CLASS>): List<X509Certificate>

This method assumes that the certificates store has been built locally. This will result in two possible scenarios:

fun buildCertChainForLocal(certificateAlias: String, certificatesStore: <ERROR CLASS>, ctx: <ERROR CLASS>): List<X509Certificate>

Overload for the buildCertChainForLocal

buildRemainingCertChain

fun buildRemainingCertChain(currentCertificate: X509Certificate, certificatesStores: Collection<<ERROR CLASS>>): List<X509Certificate>

commandLineParseAndReturnErr

fun <R : Runnable> commandLineParseAndReturnErr(runnable: R, vararg args: String): String

commandLineRunExitOnError

fun <R : Runnable> commandLineRunExitOnError(runnable: R, vararg args: String): Unit

createSignedCrl

fun createSignedCrl(signer: AuthenticatedSigner, endpointUrl: URL, nextUpdateInterval: Duration, includeInCrl: Collection<Revocation>, indirectIssuingPoint: Boolean = false): X509CRL

executeTaskWithBackOff

fun executeTaskWithBackOff(executor: ScheduledExecutorService = Executors.newScheduledThreadPool(1), maxAttempts: Int? = null, initialRetryDelayMillis: Long, taskDescription: String, ctx: <ERROR CLASS>, task: () -> Unit): Unit

Attempts a single execution of the given task, and retrying with an exponential backoff strategy if execution fails. An error is logged upon every failure but no exceptions are thrown.

getCertRole

fun <ERROR CLASS>.getCertRole(): <ERROR CLASS>

Helper method to extract cert role from certificate signing request. Default to NODE_CA if not exist for backward compatibility.

getObfuscationOptionsIfDefined

fun getObfuscationOptionsIfDefined(obfuscationOptions: <ERROR CLASS>?): <ERROR CLASS>?

Checks if the user has provided the seed or the passphrase for obfuscation, if neither is provided we imply that the config is not obfuscated

getVersionString

fun getVersionString(): Array<String>

scheduleRetryingTask

fun scheduleRetryingTask(taskDescription: String, taskExecutionInterval: Long, timeoutMillis: Long, ctx: <ERROR CLASS>, maxRetries: Int? = null, maxBackoffTimeMillis: Long? = null, task: () -> Unit): ExponentialBackOffTimer

Schedules a task to execute every taskExecutionInterval, with each failed execution using a retrying exponential backoff strategy. After a given execution has succeeded then the next execution (taskExecutionInterval after the first attempt) will continue as normal, regardless of the number of retries that the previous attempt had.

toTableFormat

fun toTableFormat(columnHeaders: List<String>, rowValues: List<List<String>>, headerSeparator: Boolean = false): List<String>

Used to display nicely formatted tables. Takes a set of columnHeaders and rowValues and returns the list of padded row strings, with correct spacing, that can be printed to console.

validateCertificateRole

fun validateCertificateRole(certificate: X509Certificate, expectedRole: <ERROR CLASS>?, serviceName: String): Unit