View Poll Results: If you read it, did you find DirectJNgine User's Guide adequate?

Voters
54. You may not vote on this poll
  • Yes

    40 74.07%
  • No

    14 25.93%
  1. #241
    Ext User
    Join Date
    Jan 2010
    Posts
    33
    Vote Rating
    0
    tungchau is on a distinguished road

      0  

    Default DirectJNGine does not support Action that implemented a Java Interface.

    DirectJNGine does not support Action that implemented a Java Interface.


    Hi,
    I found out that DirectJNGine does not support Action class that implemeted a Java Interface. It threw "IllegalArgumentException: object is not an instance of declaring class" when I tried to invoke the Action. For example, if I have MyAction class that implement IAction as the following:
    Code:
    @Service("MyAction")
    public class MyAction implements IAction {
     
    //...
    @DirectMethod
    public String doEcho(String n) {
          return n;
    }
    Calling the remote API as the following:
    Code:
    MyAction.doEcho("Tung Chau", function(p, response){
    Code:
          Ext.Msg.alert("Message::"+response.status,(response.status)? response.result : response.message);
            });
    If I make MyAction class NOT to implement IAction interface, then everything will work.
    Is this a Spring bean configuration problem, not DirectJNGine problem?

  2. #242
    Ext User
    Join Date
    Jan 2010
    Posts
    33
    Vote Rating
    0
    tungchau is on a distinguished road

      0  

    Default


    Hi Pedro,
    I had a problem described at the following thread:
    http://www.extjs.com/forum/showthrea...554#post442554

    I wonder if the problem related to GSON configuration, not DirectJNGine?

    Thanks,
    Tung Chau

  3. #243
    Ext JS Premium Member
    Join Date
    May 2009
    Location
    Barcelona (Spain)
    Posts
    218
    Vote Rating
    19
    pagullo will become famous soon enough pagullo will become famous soon enough

      0  

    Default


    Quote Originally Posted by tungchau View Post
    Hi,
    I found out that DirectJNGine does not support Action class that implemeted a Java Interface. It threw "IllegalArgumentException: object is not an instance of declaring class" when I tried to invoke the Action. For example, if I have MyAction class that implement IAction as the following:
    Code:
    @Service("MyAction")
    public class MyAction implements IAction {
     
    //...
    @DirectMethod
    public String doEcho(String n) {
          return n;
    }
    Calling the remote API as the following:
    Code:
    MyAction.doEcho("Tung Chau", function(p, response){
    Code:
          Ext.Msg.alert("Message::"+response.status,(response.status)? response.result : response.message);
            });
    If I make MyAction class NOT to implement IAction interface, then everything will work.
    DirectJNgine *does* support actions implementing interfaces: I have such an action working correctly in front of me. Please, check your facts before making such assertions, as other potential users might be lead to think DJN belongs to the "non-working/just crap" software category, which I think is not the case.

    Now, let's see whether I can help you.

    Is this a Spring bean configuration problem, not DirectJNGine problem?
    Since I am no Spring programmer, I can only guess about what's going on. But, to me, it looks like this is some configuration problem, or you need to create some kind of DJN/Spring bridge. Maybe Spring is playing proxy-like games, creating and instantiating a different class where MyAction is expected? Can you check that?

    Besides, I think Vincent Lagorce and Whatty have some software that helps bridge the DJN/Spring gap, did you check it?

    As an aside, there are a pair of good ideas/best practices in DJN can be helpful in your scenario:

    a) Use "clean" action classes whose *only* purpose is to interact with the Javascript side of the world, probably just redirecting the call to the real object in charge.
    This takes care of problems due to external lifecycle cotnrol, proxies being generated under-the-hood, etc.

    b) Define "clean" data exchange classes.
    This takes care of the potential problems you can find with very complex Java structures, that can stretch GSON a bit too much. You can alwasys configure GSON adequately, but this can be more complicated than creating simpler data exchange classes.

    I have found these practices invaluable when "strange" things happen. Integration between frameworks/libraries can be a nightmare, and making things as simple as possible can go a long way to make it easier.

    Regards,
    Pedro Agulló, Barcelona (Spain)
    Agile team building, consulting, training & development
    DirectJNgine: http://code.google.com/p/directjngine - Log4js-ext: http://www.softwarementors.com/projects/p/log4js-ext/

  4. #244
    Ext JS Premium Member
    Join Date
    May 2009
    Location
    Barcelona (Spain)
    Posts
    218
    Vote Rating
    19
    pagullo will become famous soon enough pagullo will become famous soon enough

      0  

    Default


    Quote Originally Posted by tungchau View Post
    Hi Pedro,
    I had a problem described at the following thread:
    http://www.extjs.com/forum/showthrea...554#post442554

    I wonder if the problem related to GSON configuration, not DirectJNGine?

    Thanks,
    Tung Chau
    GSON is the one in charge of JSON handling. I think it is having a hard time handling interfaces.

    You should probably pass concrete classes.
    Pedro Agulló, Barcelona (Spain)
    Agile team building, consulting, training & development
    DirectJNgine: http://code.google.com/p/directjngine - Log4js-ext: http://www.softwarementors.com/projects/p/log4js-ext/

  5. #245
    Touch Premium Member
    Join Date
    Jun 2008
    Location
    Germany, Dortmund
    Posts
    249
    Vote Rating
    12
    hschaefer123 will become famous soon enough

      0  

    Question Session scoped destructor

    Session scoped destructor


    Hi,
    i have just tested the feature concerning stateful actions.

    The action behaves the way expected, but for me i am missing
    a feature like the servlet init() and destroy() methods.

    The init() can be realized via a singleton class member, instantiated inside method,
    but how should the destroy been handled?

    I would like to exclude 'expensive/inperformant' functionality inside session scope,
    but i have to close/destroy depending things on session close.

    Any ideas?

    Best wishes,
    Holger

  6. #246
    Ext JS Premium Member
    Join Date
    May 2009
    Location
    Barcelona (Spain)
    Posts
    218
    Vote Rating
    19
    pagullo will become famous soon enough pagullo will become famous soon enough

      0  

    Default


    Quote Originally Posted by hschaefer123 View Post
    Hi,
    i have just tested the feature concerning stateful actions.

    The action behaves the way expected, but for me i am missing
    a feature like the servlet init() and destroy() methods.

    The init() can be realized via a singleton class member, instantiated inside method,
    but how should the destroy been handled?

    I would like to exclude 'expensive/inperformant' functionality inside session scope,
    but i have to close/destroy depending things on session close.

    Any ideas?

    Best wishes,
    Holger
    I think your strategy should be exactly the same you would use with "expensive" objects stored in the session: just ignore the fact that they are instantiated by DirectJNgine.
    Maybe you can use HttpSessionListener to perform expensive resource cleanup.

    You will probably need to find some of the objects stored in the session by DJN to perform cleanup. Session scoped objects are stored in the HttpSession with the "DirectJNgine.SESSION.xxx" name, where "xxx" is the action name -as set in the @DirectAction annotation (or the class name, without the package).

    Objects with application scope are stored as "DirectJNgine.APPLICATION.xxx" in the ServletContext.

    Regards
    Pedro Agulló, Barcelona (Spain)
    Agile team building, consulting, training & development
    DirectJNgine: http://code.google.com/p/directjngine - Log4js-ext: http://www.softwarementors.com/projects/p/log4js-ext/

  7. #247
    Sencha User
    Join Date
    Nov 2007
    Posts
    294
    Vote Rating
    0
    Sesshomurai is on a distinguished road

      0  

    Default Callback functions

    Callback functions


    Hi,
    I was reading the 1.2 manual and it mentions briefly about the nature of the callback function from a simple method call (not a store or form) and it would discuss more of it later in the guide. I didn't notice any further info about it.

    So my question is, how are the callback functions used to determine success or failure of the method call ,etc.

    Thanks!! Great product here.

  8. #248
    Ext JS Premium Member
    Join Date
    May 2009
    Location
    Barcelona (Spain)
    Posts
    218
    Vote Rating
    19
    pagullo will become famous soon enough pagullo will become famous soon enough

      0  

    Default


    Quote Originally Posted by Sesshomurai View Post
    Hi,
    I was reading the 1.2 manual and it mentions briefly about the nature of the callback function from a simple method call (not a store or form) and it would discuss more of it later in the guide. I didn't notice any further info about it.

    So my question is, how are the callback functions used to determine success or failure of the method call ,etc.
    Not sure what part of the documentation you are talking about, but maybe this will help (from page 13):

    The call to multiply is a bit more interesting, because it shows how to handle server errors:

    Code:
    TestAction.multiply(num.getValue(), function(result, e) {
      var t = e.getTransaction();
      if(e.status) {
        out.append(String.format(
         '<p><b>Successful call to {0}.{1} with ' +
         'response:</b><xmp>{2}</xmp></p>',
         t.action, t.method, Ext.encode(result)));
      } 
      else {
        out.append(String.format(
                '<p><b>Call to {0}.{1} failed with message:</b><xmp>{2}</xmp></p>',
          t.action, t.method, e.message));
      }
      out.el.scrollTo('t', 100000, true);
    });
    Here, we get the event transaction and check its status: if it is true, the execution of the application method finished successfully, and you can safely use the result. Else, the execution finished with a server error. For all intents and purposes this is considered to be a server error by DirectJNgine, and is notified as such to Ext Direct.

    When there is a server error, the event received by the function handling the result will have a message field, providing some kind of explanation about the problem, and if in debug mode, a where field providing additional information. This field will always be an empty string when not in debug mode.

    DirectJNgine provides as message the name of the Java exception and the message it contains, while where contains the full stack trace of the exception.
    For more info, check the ExtJs documentation, as that's what defines how ExtDirect implementations should work. Besides, depending on the context, you might find that there are specific ways to handle errors.

    Hope this helps

    Thanks!! Great product here.
    Thanks :-)
    Pedro Agulló, Barcelona (Spain)
    Agile team building, consulting, training & development
    DirectJNgine: http://code.google.com/p/directjngine - Log4js-ext: http://www.softwarementors.com/projects/p/log4js-ext/

  9. #249
    Sencha User
    Join Date
    Nov 2007
    Posts
    294
    Vote Rating
    0
    Sesshomurai is on a distinguished road

      0  

    Default


    Ahhh great. Thanks for pointing that out Pedro. Much appreciated.

  10. #250
    Ext User
    Join Date
    Aug 2009
    Posts
    20
    Vote Rating
    0
    vlagorce is on a distinguished road

      0  

    Default finally...

    finally...


    I am pleased to announce that I'll finish the spring integration I have start many month ago..

Thread Participants: 88

  1. Animal (5 Posts)
  2. barton (4 Posts)
  3. Condor (1 Post)
  4. mauro_monti (6 Posts)
  5. mbarto (1 Post)
  6. aconran (1 Post)
  7. MoShAn480 (1 Post)
  8. asgillett (2 Posts)
  9. seade (4 Posts)
  10. zaqwsxqwer (3 Posts)
  11. Sesshomurai (16 Posts)
  12. ThierryC (3 Posts)
  13. maxm165 (3 Posts)
  14. techstudios (2 Posts)
  15. sayonara (2 Posts)
  16. kschlaudt (1 Post)
  17. hschaefer123 (2 Posts)
  18. omarc (2 Posts)
  19. lxbzmy (4 Posts)
  20. mct (6 Posts)
  21. mediacept (2 Posts)
  22. dionisexorcius (1 Post)
  23. alper (1 Post)
  24. steverc (2 Posts)
  25. chrizmaster (18 Posts)
  26. J@y (21 Posts)
  27. Georgioa (6 Posts)
  28. wguan (1 Post)
  29. minneyar (16 Posts)
  30. jhoweaa (1 Post)
  31. Ramez (2 Posts)
  32. malus (1 Post)
  33. dweller (8 Posts)
  34. stdunbar (1 Post)
  35. vlagorce (20 Posts)
  36. cwilliso (1 Post)
  37. Whatty (13 Posts)
  38. Ice (1 Post)
  39. clynnh (1 Post)
  40. SreevaniN (1 Post)
  41. Stsalomon90 (1 Post)
  42. GregT (9 Posts)
  43. jcalfee (6 Posts)
  44. set_ti (1 Post)
  45. maho2nd (3 Posts)
  46. dreamtaotao (3 Posts)
  47. Toxa (4 Posts)
  48. tungchau (3 Posts)
  49. wlan0 (2 Posts)
  50. jpr (2 Posts)
  51. gianmarco (5 Posts)
  52. extjslikeit (2 Posts)
  53. harmen_wessels (1 Post)
  54. Olivercomputing2 (4 Posts)
  55. brainformance (1 Post)
  56. vanessa_ng (2 Posts)
  57. alois.cochard (5 Posts)
  58. kyrillos52 (2 Posts)
  59. Tod (1 Post)
  60. Alinanila (1 Post)
  61. tfannon (2 Posts)
  62. Kynao (1 Post)
  63. feiq (4 Posts)
  64. dalt (1 Post)
  65. xfolch (1 Post)
  66. avijit (1 Post)
  67. marcelsnews (2 Posts)
  68. maddhippy (1 Post)
  69. sritter (1 Post)
  70. july (2 Posts)
  71. jtkeller7983 (1 Post)
  72. lfranchini (2 Posts)
  73. 7/11 (2 Posts)
  74. yAdEs (1 Post)
  75. zazz (1 Post)
  76. waqar (5 Posts)
  77. pjain11 (1 Post)
  78. alexMobimesh (2 Posts)
  79. zachHurt (4 Posts)
  80. n0n3 (5 Posts)
  81. adavis2 (1 Post)
  82. mark.peters (1 Post)
  83. lee el (4 Posts)
  84. frengo19 (3 Posts)
  85. prakashwagle (1 Post)
  86. extejnar (2 Posts)
  87. alin@sonatype.com (1 Post)
  88. ajay_kango (3 Posts)