Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(corda-connector): params factory pattern support #620

Closed
petermetz opened this issue Mar 2, 2021 · 0 comments · Fixed by #725
Closed

feat(corda-connector): params factory pattern support #620

petermetz opened this issue Mar 2, 2021 · 0 comments · Fixed by #725
Assignees
Labels
Corda enhancement New feature or request

Comments

@petermetz
Copy link
Contributor

petermetz commented Mar 2, 2021

Is your feature request related to a problem? Please describe.

Right now if there's a JVM type involved in a flow invocation that cannot be constructed via a reflection-obtained constructor, then the connector backend is not much use.
One example is the currency class which has static factory methods but not constructors.

Describe the solution you'd like

The JSON embedded DSL for expressing params should support

  1. Static factory methods on the type itself that's being instantiated
  2. Factory classes with static or instance scoped methods
  3. Make sure PublicKey, Party, CordaX500name are all supported in some shape or form even if that goes beyond the initially described scope of this issue.

Describe alternatives you've considered

Considered (and even applied once) hacks like hard coding the factory invocation based on the class name. This obviously does not scale well and will end in crying when developers will want to invoke their own classes factories that are impossible to hard wire in advance within the cactus corda connector itself.

Additional context

This is a follow-up issue to the corda connector development that has an approved PR already. That PR Is being blocked right now because of the GH action outage that is still raging on despite what some might claim.

cc: @takeutak @sfuji822 @hartm @jonathan-m-hamilton @AzaharaC @jordigiam @kikoncuo

@petermetz petermetz added the enhancement New feature or request label Mar 2, 2021
@petermetz petermetz self-assigned this Mar 2, 2021
petermetz added a commit to petermetz/cacti that referenced this issue Mar 25, 2021
…ti#620

Primary change
============

Added support in the Corda ledger connector plugin's JVM backend to
have the JSON DSL be able to express static and non-static factory
functions.
For the non-static factory functions, the invocation target can be any
constructable object that the DLS can express via the `JvmObject` type.

The method lookups are performed the same way as when looking up
constructors but with the additional constraint that the name of the
method has to also match not just the parameter types/count.

Miscellaneous changes
==================

Refactored ApiPluginLedgerConnectorCordaServiceImpl.kt so that it
does not include the JSON DSL deserialization logic within itself but
instead outsources all of that to a separate class that was newly added
just for this: JsonJvmObjectDeserializer.kt

Updated the tests to specify the new invocation parameters accordingly:
The Currency class is now instantiated through the JSON DLS thanks to
the static factory method support we just added.

Published the container image to the DockerHub registry with the updated
JVM corda connector plugin under the tag:
hyperledger/cactus-connector-corda-server:2021-03-24-feat-620
(which is now used by both of the integration tests that we
currently have for corda)

The contract deployment request object will now allow a minimum of
zero items in the deployment configuration array parameter which
we needed to cover the case when a jar only needs to be deployed
to the classpath of the connector plugin because it is already present
on the Corda node's cordapps directory (meaning that adding it there
again would make it impossible to start back up the corda node)

Fixes hyperledger-cacti#620

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit to petermetz/cacti that referenced this issue Mar 25, 2021
…ti#620

Primary change
============

Added support in the Corda ledger connector plugin's JVM backend to
have the JSON DSL be able to express static and non-static factory
functions.
For the non-static factory functions, the invocation target can be any
constructable object that the DLS can express via the `JvmObject` type.

The method lookups are performed the same way as when looking up
constructors but with the additional constraint that the name of the
method has to also match not just the parameter types/count.

Miscellaneous changes
==================

Refactored ApiPluginLedgerConnectorCordaServiceImpl.kt so that it
does not include the JSON DSL deserialization logic within itself but
instead outsources all of that to a separate class that was newly added
just for this: JsonJvmObjectDeserializer.kt

Updated the tests to specify the new invocation parameters accordingly:
The Currency class is now instantiated through the JSON DLS thanks to
the static factory method support we just added.

Published the container image to the DockerHub registry with the updated
JVM corda connector plugin under the tag:
hyperledger/cactus-connector-corda-server:2021-03-24-feat-620
(which is now used by both of the integration tests that we
currently have for corda)

The contract deployment request object will now allow a minimum of
zero items in the deployment configuration array parameter which
we needed to cover the case when a jar only needs to be deployed
to the classpath of the connector plugin because it is already present
on the Corda node's cordapps directory (meaning that adding it there
again would make it impossible to start back up the corda node)

Fixes hyperledger-cacti#620

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit to petermetz/cacti that referenced this issue Mar 25, 2021
…ti#620

Primary change
============

Added support in the Corda ledger connector plugin's JVM backend to
have the JSON DSL be able to express static and non-static factory
functions.
For the non-static factory functions, the invocation target can be any
constructable object that the DLS can express via the `JvmObject` type.

The method lookups are performed the same way as when looking up
constructors but with the additional constraint that the name of the
method has to also match not just the parameter types/count.

Miscellaneous changes
==================

Refactored ApiPluginLedgerConnectorCordaServiceImpl.kt so that it
does not include the JSON DSL deserialization logic within itself but
instead outsources all of that to a separate class that was newly added
just for this: JsonJvmObjectDeserializer.kt

Updated the tests to specify the new invocation parameters accordingly:
The Currency class is now instantiated through the JSON DLS thanks to
the static factory method support we just added.

Published the container image to the DockerHub registry with the updated
JVM corda connector plugin under the tag:
hyperledger/cactus-connector-corda-server:2021-03-24-feat-620
(which is now used by both of the integration tests that we
currently have for corda)

The contract deployment request object will now allow a minimum of
zero items in the deployment configuration array parameter which
we needed to cover the case when a jar only needs to be deployed
to the classpath of the connector plugin because it is already present
on the Corda node's cordapps directory (meaning that adding it there
again would make it impossible to start back up the corda node)

Fixes hyperledger-cacti#620

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit to petermetz/cacti that referenced this issue Mar 26, 2021
…ti#620

Primary change
============

Added support in the Corda ledger connector plugin's JVM backend to
have the JSON DSL be able to express static and non-static factory
functions.
For the non-static factory functions, the invocation target can be any
constructable object that the DLS can express via the `JvmObject` type.

The method lookups are performed the same way as when looking up
constructors but with the additional constraint that the name of the
method has to also match not just the parameter types/count.

Miscellaneous changes
==================

Refactored ApiPluginLedgerConnectorCordaServiceImpl.kt so that it
does not include the JSON DSL deserialization logic within itself but
instead outsources all of that to a separate class that was newly added
just for this: JsonJvmObjectDeserializer.kt

Updated the tests to specify the new invocation parameters accordingly:
The Currency class is now instantiated through the JSON DLS thanks to
the static factory method support we just added.

Published the container image to the DockerHub registry with the updated
JVM corda connector plugin under the tag:
hyperledger/cactus-connector-corda-server:2021-03-24-feat-620
(which is now used by both of the integration tests that we
currently have for corda)

The contract deployment request object will now allow a minimum of
zero items in the deployment configuration array parameter which
we needed to cover the case when a jar only needs to be deployed
to the classpath of the connector plugin because it is already present
on the Corda node's cordapps directory (meaning that adding it there
again would make it impossible to start back up the corda node)

Fixes hyperledger-cacti#620

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit to petermetz/cacti that referenced this issue Mar 26, 2021
…ti#620

Primary change
============

Added support in the Corda ledger connector plugin's JVM backend to
have the JSON DSL be able to express static and non-static factory
functions.
For the non-static factory functions, the invocation target can be any
constructable object that the DLS can express via the `JvmObject` type.

The method lookups are performed the same way as when looking up
constructors but with the additional constraint that the name of the
method has to also match not just the parameter types/count.

Miscellaneous changes
==================

Refactored ApiPluginLedgerConnectorCordaServiceImpl.kt so that it
does not include the JSON DSL deserialization logic within itself but
instead outsources all of that to a separate class that was newly added
just for this: JsonJvmObjectDeserializer.kt

Updated the tests to specify the new invocation parameters accordingly:
The Currency class is now instantiated through the JSON DLS thanks to
the static factory method support we just added.

Published the container image to the DockerHub registry with the updated
JVM corda connector plugin under the tag:
hyperledger/cactus-connector-corda-server:2021-03-24-feat-620
(which is now used by both of the integration tests that we
currently have for corda)

The contract deployment request object will now allow a minimum of
zero items in the deployment configuration array parameter which
we needed to cover the case when a jar only needs to be deployed
to the classpath of the connector plugin because it is already present
on the Corda node's cordapps directory (meaning that adding it there
again would make it impossible to start back up the corda node)

Fixes hyperledger-cacti#620

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit to petermetz/cacti that referenced this issue Mar 26, 2021
…ti#620

Primary change
============

Added support in the Corda ledger connector plugin's JVM backend to
have the JSON DSL be able to express static and non-static factory
functions.
For the non-static factory functions, the invocation target can be any
constructable object that the DLS can express via the `JvmObject` type.

The method lookups are performed the same way as when looking up
constructors but with the additional constraint that the name of the
method has to also match not just the parameter types/count.

Miscellaneous changes
==================

Refactored ApiPluginLedgerConnectorCordaServiceImpl.kt so that it
does not include the JSON DSL deserialization logic within itself but
instead outsources all of that to a separate class that was newly added
just for this: JsonJvmObjectDeserializer.kt

Updated the tests to specify the new invocation parameters accordingly:
The Currency class is now instantiated through the JSON DLS thanks to
the static factory method support we just added.

Published the container image to the DockerHub registry with the updated
JVM corda connector plugin under the tag:
hyperledger/cactus-connector-corda-server:2021-03-24-feat-620
(which is now used by both of the integration tests that we
currently have for corda)

The contract deployment request object will now allow a minimum of
zero items in the deployment configuration array parameter which
we needed to cover the case when a jar only needs to be deployed
to the classpath of the connector plugin because it is already present
on the Corda node's cordapps directory (meaning that adding it there
again would make it impossible to start back up the corda node)

Fixes hyperledger-cacti#620

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit to petermetz/cacti that referenced this issue Mar 28, 2021
…ti#620

Primary change
============

Added support in the Corda ledger connector plugin's JVM backend to
have the JSON DSL be able to express static and non-static factory
functions.
For the non-static factory functions, the invocation target can be any
constructable object that the DLS can express via the `JvmObject` type.

The method lookups are performed the same way as when looking up
constructors but with the additional constraint that the name of the
method has to also match not just the parameter types/count.

Miscellaneous changes
==================

Refactored ApiPluginLedgerConnectorCordaServiceImpl.kt so that it
does not include the JSON DSL deserialization logic within itself but
instead outsources all of that to a separate class that was newly added
just for this: JsonJvmObjectDeserializer.kt

Updated the tests to specify the new invocation parameters accordingly:
The Currency class is now instantiated through the JSON DLS thanks to
the static factory method support we just added.

Published the container image to the DockerHub registry with the updated
JVM corda connector plugin under the tag:
hyperledger/cactus-connector-corda-server:2021-03-24-feat-620
(which is now used by both of the integration tests that we
currently have for corda)

The contract deployment request object will now allow a minimum of
zero items in the deployment configuration array parameter which
we needed to cover the case when a jar only needs to be deployed
to the classpath of the connector plugin because it is already present
on the Corda node's cordapps directory (meaning that adding it there
again would make it impossible to start back up the corda node)

Fixes hyperledger-cacti#620

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit that referenced this issue Mar 28, 2021
Primary change
============

Added support in the Corda ledger connector plugin's JVM backend to
have the JSON DSL be able to express static and non-static factory
functions.
For the non-static factory functions, the invocation target can be any
constructable object that the DLS can express via the `JvmObject` type.

The method lookups are performed the same way as when looking up
constructors but with the additional constraint that the name of the
method has to also match not just the parameter types/count.

Miscellaneous changes
==================

Refactored ApiPluginLedgerConnectorCordaServiceImpl.kt so that it
does not include the JSON DSL deserialization logic within itself but
instead outsources all of that to a separate class that was newly added
just for this: JsonJvmObjectDeserializer.kt

Updated the tests to specify the new invocation parameters accordingly:
The Currency class is now instantiated through the JSON DLS thanks to
the static factory method support we just added.

Published the container image to the DockerHub registry with the updated
JVM corda connector plugin under the tag:
hyperledger/cactus-connector-corda-server:2021-03-24-feat-620
(which is now used by both of the integration tests that we
currently have for corda)

The contract deployment request object will now allow a minimum of
zero items in the deployment configuration array parameter which
we needed to cover the case when a jar only needs to be deployed
to the classpath of the connector plugin because it is already present
on the Corda node's cordapps directory (meaning that adding it there
again would make it impossible to start back up the corda node)

Fixes #620

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
jordigiam pushed a commit to kikoncuo/cactus that referenced this issue Apr 8, 2021
…ti#620

Primary change
============

Added support in the Corda ledger connector plugin's JVM backend to
have the JSON DSL be able to express static and non-static factory
functions.
For the non-static factory functions, the invocation target can be any
constructable object that the DLS can express via the `JvmObject` type.

The method lookups are performed the same way as when looking up
constructors but with the additional constraint that the name of the
method has to also match not just the parameter types/count.

Miscellaneous changes
==================

Refactored ApiPluginLedgerConnectorCordaServiceImpl.kt so that it
does not include the JSON DSL deserialization logic within itself but
instead outsources all of that to a separate class that was newly added
just for this: JsonJvmObjectDeserializer.kt

Updated the tests to specify the new invocation parameters accordingly:
The Currency class is now instantiated through the JSON DLS thanks to
the static factory method support we just added.

Published the container image to the DockerHub registry with the updated
JVM corda connector plugin under the tag:
hyperledger/cactus-connector-corda-server:2021-03-24-feat-620
(which is now used by both of the integration tests that we
currently have for corda)

The contract deployment request object will now allow a minimum of
zero items in the deployment configuration array parameter which
we needed to cover the case when a jar only needs to be deployed
to the classpath of the connector plugin because it is already present
on the Corda node's cordapps directory (meaning that adding it there
again would make it impossible to start back up the corda node)

Fixes hyperledger-cacti#620

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Corda enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant