Adds todos that will improve java interop.

This commit is contained in:
Joel Dudley 2016-12-09 14:30:52 +00:00
parent a007ecf980
commit ae349a8831
5 changed files with 17 additions and 0 deletions

View File

@ -61,6 +61,8 @@ inline fun <R> requireThat(body: Requirements.() -> R) = Requirements.body()
//// Authenticated commands ///////////////////////////////////////////////////////////////////////////////////////////
// TODO: Provide a version of select that interops with Java
/** Filters the command list by type, party and public key all at once. */
inline fun <reified T : CommandData> Collection<AuthenticatedObject<CommandData>>.select(signer: CompositeKey? = null,
party: Party? = null) =
@ -69,6 +71,8 @@ inline fun <reified T : CommandData> Collection<AuthenticatedObject<CommandData>
filter { if (party == null) true else party in it.signingParties }.
map { AuthenticatedObject(it.signers, it.signingParties, it.value as T) }
// TODO: Provide a version of select that interops with Java
/** Filters the command list by type, parties and public keys all at once. */
inline fun <reified T : CommandData> Collection<AuthenticatedObject<CommandData>>.select(signers: Collection<CompositeKey>?,
parties: Collection<Party>?) =

View File

@ -54,6 +54,8 @@ abstract class FlowLogic<out T> {
return sendAndReceive(otherParty, payload, T::class.java)
}
// TODO: Move the receiveType param to first position for readability
@Suspendable
fun <T : Any> sendAndReceive(otherParty: Party, payload: Any, receiveType: Class<T>): UntrustworthyData<T> {
return fsm.sendAndReceive(otherParty, payload, receiveType, sessionFlow)
@ -61,6 +63,8 @@ abstract class FlowLogic<out T> {
inline fun <reified T : Any> receive(otherParty: Party): UntrustworthyData<T> = receive(otherParty, T::class.java)
// TODO: Move the receiveType param to first position for readability
@Suspendable
fun <T : Any> receive(otherParty: Party, receiveType: Class<T>): UntrustworthyData<T> {
return fsm.receive(otherParty, receiveType, sessionFlow)

View File

@ -31,6 +31,9 @@ sealed class StateMachineUpdate(val id: StateMachineRunId) {
* RPC operations that the node exposes to clients using the Java client library. These can be called from
* client apps and are implemented by the node in the [CordaRPCOpsImpl] class.
*/
// TODO: The use of Pairs throughout is unfriendly for Java interop.
interface CordaRPCOps : RPCOps {
/**
* Returns a pair of currently in-progress state machine infos and an observable of future state machine adds/removes.

View File

@ -132,6 +132,9 @@ sealed class PortAllocation {
* @param dsl The dsl itself.
* @return The value returned in the [dsl] closure.
*/
// TODO: Add an @JvmOverloads annotation
fun <A> driver(
driverDirectory: Path = Paths.get("build", getTimestampAsDirectoryName()),
portAllocation: PortAllocation = PortAllocation.Incremental(10000),

View File

@ -96,6 +96,9 @@ class CordaRPCClient(val host: HostAndPort, override val config: NodeSSLConfigur
*
* @throws RPCException if the server version is too low or if the server isn't reachable within the given time.
*/
// TODO: Add an @JvmOverloads annotation
@Throws(RPCException::class)
fun proxy(timeout: Duration? = null, minVersion: Int = 0): CordaRPCOps {
return state.locked {