Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Service Locator

 
Jen Carol
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are two service locators necessary - one for the web tier and one for the ejb tier? Is it possible to have only one service locator? i.e. the web service locator is also used by the SLSB to lookup the entity beans?
 
Jeremy Hsu
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, it really depends on the complexity of your system. If your business tier exposes a lot of remote session beans, it might be good if you can encapsulate some of the home object access code in the service locator on the web-tier side.

Remember EJB patterns are there to simplify the code and if you feel the ejb pattern you applied actually complicates the code, you probably should be thinking if you should apply the pattern in the first place.
[ June 30, 2005: Message edited by: Jeremy Hsu ]
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jen,

Both Sun's blueprints example at http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/app-arch/app-arch5.html and Cade's case use only one Service Locator. So, probably one is enough.

-- Dan
 
Anush Varma
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sun's petsore example has 2 implementations of the service locator, one for the web which is a singleton and implements caching and the other for the business layer which is a non-sigleton and no caching. Thats probably why they have 2 service locators, otherwise a single service locator would have been fine.
 
vu lee
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The main goal of service locator is to hiding to process of locating business components and services. For the client like swing or applet, service locator should be on the client tier. If the service locator has been modified, all clients are forced to get the modified version. Is it bad?
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic