Core J2EE
Pattern Catalog
Last
Updated:
January 29, 2006 8:54 PM
In Association with Amazon.com
Service To Worker
See Core J2EE Patterns,
2nd Edition for full description of this pattern and its strategies.
Problem
You want to perform core request handling and invoke business logic
before control is passed to the view.
Forces
- You want specific business logic executed to service a request in
order to retrieve content that will be used to generate a dynamic response.
- You have view selections which may depend on responses from business
service invocations.
- You may have to use a framework or library in the application.
Solution
Use Service to Worker to centralize control and request handling
to retrieve a presentation model before turning control over to the view.
The view generates a dynamic response based on the presentation model.
Class Diagram
Sequence Diagram
Strategies
- Servlet Front Strategy
- JSP Front Strategy
- Template-Based View Strategy
- Controller-Based View Strategy
- JavaBean Helper Strategy
- Custom Tag Helper Strategy
- Dispatcher in Controller Strategy
Consequences
- Centralizes control and improves modularity, reusability, and maintainability
- Improves role separation
Related Patterns
- Front Controller, Application
Controller, and View Helper
Service to Worker is a controller-centric architecture, highlighting
a Front Controller. The Front Controller delegates to an Application
Controller for navigation and dispatch, then to view and helpers.
- Composite View
The view can be a Composite View.
- Business Delegate
A Business Delegate is used to hide any remote semantics of the business
service.
- Dispatcher View
Dispatcher View is a view-centric architecture, where business processing
is done after control is passed to the view.
- Business Delegate
A Business Delegate reduces the coupling between a helper object and
a remote business service, upon which the helper object can invoke.
Excerpted from Core J2EE
Patterns, 2nd Edition. See the book for full description of the pattern
including class diagrams, sequence diagrams and sample code.