Java Reference
In-Depth Information
Forces
• Consolidate EJB, JMS, or data source object lookup into a reusable component that
encapsulates the complexities of interaction with the JNDI API.
• The JNDI lookup should be independent of vendor API classes and interfaces. In
fact, it should be possible to switch between different servers merely by changing
configuration parameters.
• The service lookup code should be flexible enough to support different types of
business objects: EJBs, POJO, or even web services.
• Address the performance concerns associated with JNDI lookup.
Solution
Use a service locator to encapsulate JNDI object lookup and eliminate any performance
overhead.
Strategies with the Spring Framework
As I explained in Chapter 3, page controllers are the most appropriate components to
start interaction with the business tier. They do so by invoking methods on POJO busi-
ness delegate objects. The business delegates provide the client-side interface for the
business tier and are responsible for accessing the remote EJB objects. They, in turn, rely
on the service locator to retrieve the EJB home object. Figure 4-1 shows this interaction.
Figure 4-1. Sequence diagram: service locator interaction
 
Search WWH ::




Custom Search