|
You want to transparently locate business components and services
in a uniform manner.
- You want to use the JNDI API to look up and use business components,
such as enterprise beans and JMS components, and services such as data
sources.
- You want to centralize and reuse the implementation of lookup mechanisms
for J2EE application clients.
- You want to encapsulate vendor dependencies for registry implementations,
and hide the dependency and complexity from the clients.
- You want to avoid performance overhead related to initial context
creation and service lookups.
- You want to reestablish a connection to a previously accessed enterprise
bean instance, using its Handle object.
Use a Service Locator to implement and encapsulate service and
component lookup. A Service Locator hides the implementation details of
the lookup mechanism and encapsulates related dependencies.
Class Diagram
Sequence Diagram
- EJB Service Locator Strategy
- JDBC DataSource Service Locator Strategy
- JMS Service Locator Strategies
- JMS Queue Service Locator Strategy
- JMS Topic Service Locator Strategy
- Web Service Locator Strategy
- Abstracts complexity
- Provides uniform service access to clients
- Facilitates adding EJB business components
- Improves network performance
- Improves client performance by caching
- Business Delegate
Business Delegate uses a Service Locator to locate and obtain references
to the business service objects, such as EJB objects, JMS topics, and
JMS queues. This separates the complexity of service location from the
Business Delegate, leading to loose coupling and increased manageability.
- Session Façade
Session Façade uses a Service Locator to locate and obtain home
and remote references to the session beans and entity beans, as well
as to locate a data source.
- Transfer Object Assembler
Transfer Object Assembler uses a Service Locator to locate references
to session beans and entity beans that it needs to access data and build
a composite transfer object.
- Data Access Object
A Data Access Object uses a Service Locator to look up and obtain a
reference to a data source.
|