How to import java library into uniface

Author: nei.fassula@dnacode.com.br (neifassula)

I've had a lock at documentation and I saw that is possible to call uniface operations from java classes, using as describe in java call-in documentation.   But are there some way to import a java library into uniface and then call it using the activate? Many thanks Nei

20 Comments

  1. Hello Nei, Unfortunately, as you have probably already noticed, we do not have a direct Java call-out mechanism in Uniface. But using a C module that calls Java via JNI you can do quite a lot. In fact last year I worked on such a thing, a signature plus 3GL module which lets you call more or less arbitrary Java classes - provided they use only basic parameters and return values (numeric, string, boolean). I had planned to document this and publish it here but never found the time for it. If you think this can be useful for you I can give you the details. It might be good if someone other than me tries it out before it gets published :)   Cheers, Chris Breemer Uniface Technical Support 


    Author: Chris Breemer (chris.breemer@uniface.com)
  2. Hi Chris, Yes, I think this can be useful. Would be nice if you can share the details about it, so I can advance with my researchs, and will be nice if I can contribute somehow. Feel free to call me privately via email "nei.fassula@dnacode.com.br" or even via Skype "cfassula". Many thanks Nei


    Author: neifassula (nei.fassula@dnacode.com.br)
  3. Hello Nei, Ok. I'll need to get this off the shelf and make it work with Uniface 9.7. Watch this space. Cheers Chris


    Author: Chris Breemer (chris.breemer@uniface.com)
  4. Hello Chris Any news about it? If you need I'm happy to try to make it works with Uniface 9.7. Cheers Nei


    Author: neifassula (nei.fassula@dnacode.com.br)
  5. Hello Nei, I am working on it as we speak. What I still need to do is implement it on Windows 64 bits. When that works I'll start wrapping it up for publication. Should not take very long now !   Cheers, Chris Breemer


    Author: Chris Breemer (chris.breemer@uniface.com)
  6. It's now working on Win32, Win64, and Linux. Now I remember there was a memory leak on repeated invocation. I guess may as well try and fix that before making it available. Working on it.... Cheers, Chris Breemer


    Author: Chris Breemer (chris.breemer@uniface.com)
  7. Chris Breemer said It's now working on Win32, Win64, and Linux. Now I remember there was a memory leak on repeated invocation. I guess may as well try and fix that before making it available. Working on it.... Cheers, Chris Breemer  

    Hello Chris,  Many thanks for the update. I'm locking forward to see it working.  Cheers Nei


    Author: neifassula (nei.fassula@dnacode.com.br)
  8. Hello Chris,  Do you have any news about it? I appreciate if you could share the project as it is, maybe where you are in the project will contribute a lot with mine. And I'm happy to contribute to fix some bug and getting the project done.    Cheers Nei


    Author: neifassula (nei.fassula@dnacode.com.br)
  9. neifassula said Hello Chris,  Do you have any news about it? I appreciate if you could share the project as it is, maybe where you are in the project will contribute a lot with mine. And I'm happy to contribute to fix some bug and getting the project done.    Cheers Nei  

    Hello Nei ! I am just wrapping it all up, code and documentation are done, it is merely a question of packaging and uploading. Should be any day now. Stay tuned ! Chris


    Author: Chris Breemer (chris.breemer@uniface.com)
  10. Hello Nei, and others interested, Please find a first version of my Java call-out module in the Community Samples section. Your feedback will be greatly appreciated. Cheers, Chris


    Author: Chris Breemer (chris.breemer@uniface.com)
  11. Hello Chris, Many thanks for share! I'm going to have a look at the  project and I'll let you to know my point of view. once again, Many thanks! Nei


    Author: neifassula (nei.fassula@dnacode.com.br)
  12. Hi Chris, a very nice piece of work, I just had a quick glanceand a first import under 9604. Given a bit more time, I will return some proofreading/typohunting to you. Greetings from Frankfurt/Germany to Amsterdam, Uli    P.S. On your:     fp = popen(cmd, "r"); <snip>     //fclose(fp);    //???????????????????????????????????????????? Andrew Hunt / David Thomas in "The Pragmatic Programmer - From Journeyman to Master" from 2000 in chapter 4 under "25 Balancing Resources", there is an example where a file is opened, but not always closed. As the "Single Responsibility Principle" it is the duty of the method opening a resource to close it as well.


    Author: ulrich-merkel (ulrichmerkel@web.de)
  13. Hi Nei and Uli, and others who had already downloaded this, Please download again - I fixed a couple of little fluffs, one of them not closing the pipe. ( Thanks for spotting that Uli. Though I don't need a book to know I should close my files Wink ) Have fun.   Chris


    Author: Chris Breemer (chris.breemer@uniface.com)
  14. To support testing, I added the following entry called in the RETR:   entry load_test variables    string v_occlist endvariables putlistitems/occ v_occlist,"A.A" putmess v_occlist askmess "Which Testset?","concatStrings,upperCase,multiply,listParameters" selectcase($status)    case 1       v_occlist = "CLASS=myclass·;METHOD=concatStrings·;SIGNATURE=(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;·;ARGLIST=Hello, |world !·;CLASSPATH=.·;JVMOPTIONS=-XX:+PrintGCDetails -DDEBUG=true·;SEPARATOR=|·;GC=T·;BUFSIZE=1000·;CDEBUG=T"    case 2       v_occlist = "CLASS=myclass·;METHOD=upperCase·;SIGNATURE=(Ljava/lang/String;)Ljava/lang/String;·;ARGLIST=Hello, world !·;CLASSPATH=.·;JVMOPTIONS=·;SEPARATOR=·;GC=·;BUFSIZE=·;CDEBUG="    case 3       v_occlist = "CLASS=myclass·;METHOD=multiply·;SIGNATURE=(II)I·;ARGLIST=81*12345679·;CLASSPATH=.·;JVMOPTIONS=·;SEPARATOR=*·;GC=·;BUFSIZE=·;CDEBUG="    case 4       v_occlist = "CLASS=myclass·;METHOD=listParameters·;SIGNATURE=(ZBCDFIJSLjava/lang/String;)Ljava/lang/String;·;ARGLIST=1,2,A,3.14,2.718,123456,789012345,99,foo bar·;CLASSPATH=.·;JVMOPTIONS=-·;SEPARATOR=,·;GC=·;BUFSIZE=·;CDEBUG=" endselectcase getlistitems/occ v_occlist,"A.A" end ; load_test


    Author: ulrich-merkel (ulrichmerkel@web.de)
  15. Test passed all my available versions from 9604 upwards, even on 10201. Thanks Chris for opening the gate to JavaWorld, Uli


    Author: ulrich-merkel (ulrichmerkel@web.de)
  16. Thanks for testing that Uli. But I was not in doubt it would work with different versions (actually I did verify it on Uniface 10). What would be more interesting to know is whether this can do what people actually need, rather than just 3 very trivial tests. The trouble is that I know there is a lot of interest in this, but I don't know what exactly people intend to do with it. Except in one case where I already said it was not possible :-/ Cheers, Chris 


    Author: Chris Breemer (chris.breemer@uniface.com)
  17. Hi Chris, I think it would be benefitial for potential users (as you said: a lot of interest) if you can add the "verified against uniface version" to your documentation. And it may be helpful to mention the your compiled archive requires version 97 (I assume?). Given a bit of time, I will test a bit more on the technical side like transfering collections and lists. Once again: thank you for sharing, Uli


    Author: ulrich-merkel (ulrichmerkel@web.de)
  18. Hi Chris, sharing toughts because I've sometimes discussed the option to interface Uniface with Java world with customer. The basic functionality requested is to be able to activate "Java services" from Uniface, more or less in the same way like Uniface is already doing today with other technologies; this means a larger data type support than your current implementation. Hope it helps... Gianni


    Author: gianni (gianni.sandigliano@unifacesolutions.com)
  19. Import the Java classes of the Java Call-In API into each Java call-in application


    Author: assignmenthelpexperts (assignmenthelpexperts4@gmail.com)
  20. It is interesting to read your blog post and I am going to share it with my friends.


    Author: James William (board@sharklasers.com)