Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes OO, Patterns, UML and Refactoring and the fly likes EJB Command pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "EJB Command pattern" Watch "EJB Command pattern" New topic
Author

EJB Command pattern

roul ravashimka
Ranch Hand

Joined: Mar 16, 2004
Posts: 53
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


MSc Electronics, ICT
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
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?


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
roul ravashimka
Ranch Hand

Joined: Mar 16, 2004
Posts: 53
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)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
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

Joined: Mar 16, 2004
Posts: 53
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)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB Command pattern
 
Similar Threads
EJBObject question.
Local/Remote interface
Session Beans & Entity Beans together
invoking remote ejb across network
EJB End Point Design?