• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EJB Command pattern

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
i just take a look at a command used in a ejb command.
They use the remote interface in the execute method of the command. I thought that the command was executed at ejb-layer, so there's no need for a remote interface, you could use local interfaces.
What do you think about this?
Greetings,
roul
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmmm, the command is a session bean and you have to use remote interface to call Execute? Not something I'd do, I think.
Yeah, any of these would be more common:
* Execute a command on the client which may or may not do remote calls to EJB servers. That's just part of client design. The server knows nothing about commands.
* Pass a POJO command to the server which then executes the command. Client and server both have dependencies on the command.
* Pass a key to the server which maps the key to a command and executes the command. Only the server has a dependency on the command. The servlet spec is pretty much this.
Waddya think?
 
roul ravashimka
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Pass a POJO command to the server which then executes the command


if the server executes the command, the execute method could use local interfaces?
If you follow the design of Floyd Marinescu, there's a router at in the presentation layer which sends the command to a server in the ejb-layer.
This server has only one method which can execute all commandx. The code within de command'sexecute method could use local interfaces because it is executed at ejb-layer.
roul
 
Stan James
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey, there's Floyd's book - unopened - on my desk! Looks like he's talking about two or more of those flavors at once: the code in the appendix and an IBM implementation.
He mentions that in IBM's version the command does the EJB housework for you, hiding all the get Home, get Remote, etc like a business delegate. That means the command is doing remote stuff with full awareness of EJB.
The other option sends the command to the server where it is executed. This way the command can do local POJO stuff with no awareness of EJB or call local EJBs right on the server.
Ah, choices. Keeps life interesting, no?
 
roul ravashimka
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks Stan James,
So it looks Floyd combines to strategies in one.

Hey, there's Floyd's book - unopened - on my desk!


Unopend because you don't got the time, or because you don't like what he' saying?
Roul
 
Stan James
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Unopened cause I just got it recently and because I'm not really doing EJB right now. I say not really because I am using a vendor framework that has ONE session bean as its public interface, so my code is running in the EJB container and it wouldn't hurt me to read the book.
I had my first EJB class from Ed Roman, Floyd's partner or employer or something. I thought he did a super job of introducing the technology and I liked his book Mastering EJB so I approach anything from these guys with positive expectations.
 
reply
    Bookmark Topic Watch Topic
  • New Topic