Meaningless Drivel is fun!*
The moose likes EJB and other Java EE Technologies and the fly likes Patterns for home and remote objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Patterns for home and remote objects" Watch "Patterns for home and remote objects" New topic
Author

Patterns for home and remote objects

Daryl Le
Greenhorn

Joined: Jan 24, 2002
Posts: 21
What patterns are being used by the home and remote objects in EJB? Thanks.
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Go read Core J2EE Patterns by Alur, et. al.
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Daryl Le
Greenhorn

Joined: Jan 24, 2002
Posts: 21
Originally posted by Kyle Brown:
Go read Core J2EE Patterns by Alur, et. al.
Kyle

Could some one please point it out in what specific chapters I can find this information?
Thanks,
Daryl
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Your question was not specific enough to give any indication of what you plan on using these patterns to solve. Therefore, I can't give you a specific chapter. It would behoove you to read the whole book.
Kyle
Daryl Le
Greenhorn

Joined: Jan 24, 2002
Posts: 21
Sorry for the confusion. In EJB, the designs for EJBHome and EJBObject interfaces apply a certain design patterns. What are they? For example, are Factory pattern being applied for the EJBHome and Proxy and Decorator are being applied for the EJBObject?
Thanks,
Daryl
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
OK, that helps a bit.
By far the most common design patterns applied are the following:
Factory (Notice I didn't say "Factory Method" or "Abstract Factory" -- just "Factory"): EJB Homes are factories for EJB objects. That pretty much goes without saying.
Facade: An EXTREMELY common pattern that should be applied to EJB designs is to utilize Session Beans as Facades. This is quite well documented in the "Core J2EE Patterns" book as "Session Facade". More information on the use of the facade pattern in this way can be found here. In this case the public methods exposed by the remote interface of the session beans (or the local interface in EJB 2.0) are the Facade methods.
Command: Another quite common design pattern used in EJB's. In this case you have a very simplistic Session Facade remote (or local) interface (sometimes consisting of only one method -- "executeCommand()" and the Commands are passed into this method. The IBM Patterns Development Kit features this approach. This thread on the serverside discusses the design.
Singleton: While EJB's aren't singletons themselves, it's sometimes useful to place a stateless session bean facade in front of a Singleton data cache. This article describes that approach.
Proxy: As you've noticed, the EJB Stubs are proxies to the EJB implementation classes, as with other remote object implementations like CORBA or RMI.
I don't think EJB objects are really decorators. The way in which they are used doesn't really match the intent of the pattern. I agree that it's close, but I'm not convinced...
Kyle
[ February 02, 2002: Message edited by: Kyle Brown ]
Daryl Le
Greenhorn

Joined: Jan 24, 2002
Posts: 21
Thanks for the explanation. Daryl.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Patterns for home and remote objects