corda / net.corda.finance.workflows.asset.selection / AbstractCashSelection

AbstractCashSelection

abstract class AbstractCashSelection

Pluggable interface to allow for different cash selection provider implementations Default implementation in finance workflow module uses H2 database and a custom function within H2 to perform aggregation. Custom implementations must implement this interface and declare their implementation in META-INF/services/net.corda.finance.workflows.asset.selection.AbstractCashSelection.

Constructors

<init>

Pluggable interface to allow for different cash selection provider implementations Default implementation in finance workflow module uses H2 database and a custom function within H2 to perform aggregation. Custom implementations must implement this interface and declare their implementation in META-INF/services/net.corda.finance.workflows.asset.selection.AbstractCashSelection.

AbstractCashSelection(maxRetries: Int = 8, retrySleep: Int = 100, retryCap: Int = 2000)

Functions

executeQuery

A vendor specific query(ies) to gather Cash states that are available.

abstract fun executeQuery(connection: Connection, amount: Amount<Currency>, lockId: UUID, notary: Party?, onlyFromIssuerParties: Set<AbstractParty>, withIssuerRefs: Set<OpaqueBytes>, withResultSet: (ResultSet) -> Boolean): Boolean

isCompatible

Upon dynamically loading configured Cash Selection algorithms declared in META-INF/services this method determines whether the loaded implementation is compatible and usable with the currently loaded JDBC driver. Note: the first loaded implementation to pass this check will be used at run-time.

abstract fun isCompatible(metadata: DatabaseMetaData): Boolean

toString

abstract fun toString(): String

unconsumedCashStatesForSpending

Query to gather Cash states that are available and retry if they are temporarily unavailable.

fun unconsumedCashStatesForSpending(services: ServiceHub, amount: Amount<Currency>, onlyFromIssuerParties: Set<AbstractParty> = emptySet(), notary: Party? = null, lockId: UUID, withIssuerRefs: Set<OpaqueBytes> = emptySet()): List<StateAndRef<State>>

Companion Object Properties

instance

val instance: AtomicReference<AbstractCashSelection>

Companion Object Functions

getInstance

fun getInstance(metadata: () -> DatabaseMetaData): AbstractCashSelection

Inheritors

CashSelectionH2Impl

class CashSelectionH2Impl : AbstractCashSelection

CashSelectionPostgreSQLImpl

class CashSelectionPostgreSQLImpl : AbstractCashSelection

CashSelectionSQLServerImpl

class CashSelectionSQLServerImpl : AbstractCashSelection