Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

14. Patterns and Struts: Enterprise Desi... > Simplify your Business Delegates wit...

Simplify your Business Delegates with the Service Locator

Unless your Business Delegates use a Service Locator, they will have duplicate code for dealing with the lookup service.

To implement a Service Locator, we’ll take all of the logic for doing the JNDI lookup and move it out of the multiple Business Delegates and into a single Service Locator.

Typically in J2EE applications, there will be a number of components that all use the same JNDI service. While a complex application might use several different registries such as JNDI and UDDI (for web service endpoints), an individual component will typically need access to only one registry. In general, a single Service Locator will support a single, specific registry.

By making the Business Delegate an object that handles only the business methods rather than also handling the registry lookup code, you increase the cohesion for the Business Delegates.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial