aspose file tools*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Factory Pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Factory Pattern" Watch "Factory Pattern" New topic
Author

Factory Pattern

priya shankar
Greenhorn

Joined: May 12, 2003
Posts: 21
Hi all
In ejb ,home interface acts as a factory to create ejbobjects ...huv..
huv it implements the decoupling ...
thanks
priya
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
I don't understand the question. Could you please elaborate?


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
priya shankar
Greenhorn

Joined: May 12, 2003
Posts: 21
Hi Ilja
I mean that , Ejb home object is factory for creating EJBObjects ....huv it is?
priya
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
EJBHome is a factory because it's managing the creation of EJBObjects. I.e. you don't say "new MySessionBean()" but call a factory method called "EJBHome.create(...)".


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
priya shankar
Greenhorn

Joined: May 12, 2003
Posts: 21
Thanks
But what makes EjbHome to act as Factory ....A factory should allow its subclasse to create instances...
where it happens ..
priya
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
But what makes EjbHome to act as Factory ....A factory should allow its subclasse to create instances...

The intent of the GoF pattern "Factory Method":
Define an interface for creating an object, but let subclasses decide which class to instantiate.
"Define an interface" has been fulfilled with javax.ejb.EJBHome.
"let subclasses decide which class to instantiate" is fulfilled by the container generating vendor-specific decorating classes of the EJBHome interface specified by the bean developer, such as com.foobar.MySessionHome_impl for a home interface called com.foobar.MySessionHome.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Factory Pattern
 
Similar Threads
Session
MVC
Struts
Data Source
WA #1.....word association