Re: Are Java actions first class citizens?

2017-09-13 Thread Minto van der Sluis

Thanks for your reply Ben.

I added a remark to issue 2466 referring to my attempt and the the 
issues I run into.


A possible way out is  to modify the swagger template to cope with 
untyped properties. I will look into this once I have some time ;-)


Regards,

Minto


On 13-09-17 14:49, Ben Browning wrote:

Is there a bug for the KeyValue class being generated incorrectly from the
Swagger spec? That's something we should be able to fix to make generating
clients in other languages, like Java, easier. At a glance it looks like
perhaps the type of the value property should be defined as object which
translates to java.lang.Object (so anything) in generated Java client code.

I'll take a look and add some comments on issue 2590 to help you get the
changes tested.

Ben


On Mon, Sep 11, 2017 at 4:15 PM, Minto van der Sluis <mi...@xup.nl> wrote:


Hi,

I have been scratching the surface of Openwhisk and I like it a lot. But
since Java is the eco system (language + tooling) I am most comfortable
with, I would like to create my actions in java. Luckily Openwhisk supports
Java.

Unfortunately diving a bit deeper somehow gives me the impression that
Java is not really a first class citizen. Why do I get this impression?
There are a number of reasons:

1) Examples

I can hardly find any decent Java based examples beyond hello world. In
particular how to invoke other actions from within a Java action.

Seaching on Github with "Openwhisk java" results in only 4 projects :-(
and one of them is mine (see 2)

2) Openwhisk java client API

Searching for Openwhisk client libraries results in libraries for
javascript, swift, go and python. Unfortunately none for java. There is
however a feature request: https://github.com/apache/incu
bator-openwhisk/issues/2466

I had a little go at it myself. The API is mostly generated from the
swagger file. Unfortunately the Swagger code generator generates unusable
code for one the most important data structures, KeyValue.

My Openwhisk Java API can be found at: https://github.com/misl/openwh
isk-client-java

Yes it desperately needs some additional documentation, but first I want
to fix the KeyValue issue. And example of using the library from outside
openwhisk can be found in the code at: https://github.com/misl/openwh
isk-client-java/blob/master/openwhisk-api-client-retrofit/
src/test/java/SimpleTest.java

3) Fully qualified method name does not work for Java action handlers
(see: wsk action create --main)

For this I already created an issue: https://github.com/apache/incu
bator-openwhisk/issues/2590

I even tried solving this one myself, have a look at my fork at:
https://github.com/misl/incubator-openwhisk

Fixing the issue was easy, but testing it seems to be much more complex.
Maybe I need a little help here to be able to complete this one.


All this gives me the impression that the focus for Openwhisk is on a lot
of languages but not on Java. Or am I totally wrong here?

Please share your thoughts.

Kind regards,

misl

PS 1: For the interested I might have another project worth taking a look
at. Openwhisk Package and Action annotations -
https://github.com/misl/xup-openwhisk-annotations . It includes a script
to quickly upload the generated Jar file. This one is also still needs
documentation, but to see how it works have a look at the examples.

PS 2: Oh by the way, If any of these projects are of interest, I am
willing to donate.







Re: Are Java actions first class citizens?

2017-09-13 Thread Minto van der Sluis

Hi Rodric,

The complexity was not really in the code changes or in building it. But 
more I trying to get my own environment up and running and check if it 
worked with my own actions. But I have to admit I have not spent much 
time on trying to set it up after my first attempt failed.


Adding the test scenario's was more like monkey see monkey do. I was 
only surprised to see the tests separated from the code. But that is 
probably due to the tests being integration test (initially I was 
looking for unittests).


Since you tested my changes, I there anything I need to do to get these 
changes accepted?


Regards,

misl


On 13-09-17 16:20, Rodric Rabbah wrote:

I ran your test for the fully qualified name after reviewing it and it
passes. Was your concern that writing the test was too hard or too coarse
grained to do?
It's true, it would be nice to just test the name resolution, as opposed
going through the entire flow and initializing/communicating with an actual
container.
If that's what you mean by "complex" - I think adding unit tests for the
Java proxy makes sense. +1

Otherwise, your test is fine. I made a small change locally just to be
paranoid.
https://github.com/rabbah/openwhisk/commit/7d6cf94fc587390ec97fe27313d352
62c38dfdc9

-r





Are Java actions first class citizens?

2017-09-11 Thread Minto van der Sluis

Hi,

I have been scratching the surface of Openwhisk and I like it a lot. But 
since Java is the eco system (language + tooling) I am most comfortable 
with, I would like to create my actions in java. Luckily Openwhisk 
supports Java.


Unfortunately diving a bit deeper somehow gives me the impression that 
Java is not really a first class citizen. Why do I get this impression? 
There are a number of reasons:


1) Examples

I can hardly find any decent Java based examples beyond hello world. In 
particular how to invoke other actions from within a Java action.


Seaching on Github with "Openwhisk java" results in only 4 projects :-( 
and one of them is mine (see 2)


2) Openwhisk java client API

Searching for Openwhisk client libraries results in libraries for 
javascript, swift, go and python. Unfortunately none for java. There is 
however a feature request: 
https://github.com/apache/incubator-openwhisk/issues/2466


I had a little go at it myself. The API is mostly generated from the 
swagger file. Unfortunately the Swagger code generator generates 
unusable code for one the most important data structures, KeyValue.


My Openwhisk Java API can be found at: 
https://github.com/misl/openwhisk-client-java


Yes it desperately needs some additional documentation, but first I want 
to fix the KeyValue issue. And example of using the library from outside 
openwhisk can be found in the code at: 
https://github.com/misl/openwhisk-client-java/blob/master/openwhisk-api-client-retrofit/src/test/java/SimpleTest.java


3) Fully qualified method name does not work for Java action handlers 
(see: wsk action create --main)


For this I already created an issue: 
https://github.com/apache/incubator-openwhisk/issues/2590


I even tried solving this one myself, have a look at my fork at: 
https://github.com/misl/incubator-openwhisk


Fixing the issue was easy, but testing it seems to be much more complex. 
Maybe I need a little help here to be able to complete this one.



All this gives me the impression that the focus for Openwhisk is on a 
lot of languages but not on Java. Or am I totally wrong here?


Please share your thoughts.

Kind regards,

misl

PS 1: For the interested I might have another project worth taking a 
look at. Openwhisk Package and Action annotations - 
https://github.com/misl/xup-openwhisk-annotations . It includes a script 
to quickly upload the generated Jar file. This one is also still needs 
documentation, but to see how it works have a look at the examples.


PS 2: Oh by the way, If any of these projects are of interest, I am 
willing to donate.