Java Reference
In-Depth Information
7.3 Designing a POJO façade's interface
The process of implementing a POJO façade consists of the following steps:
Design the POJO façade's public interface.
1
Implement the POJO façade's methods, which call the domain model
objects and the result object factory.
2
Implement the result object factory that is called by the POJO façade to
detach the domain objects.
3
Configure the Spring framework's AOP interceptors, which provide ser-
vices such as transaction management.
4
In this section, you will learn how to design the POJO façade's public interface. We
describe how to identify the methods and the parameters, and how to return val-
ues. You will also see examples of how to encapsulate the domain objects to pre-
vent the presentation tier from calling methods that it should not. We use the
PlaceOrderFacade , which we introduced earlier, as an example. Later sections in
this chapter describe the other steps in the process.
7.3.1
Determining the method signatures
The design of a POJO façade is driven by the needs of the presentation tier. Each
POJO façade method corresponds to a request handled by the presentation tier.
The method's parameters correspond to user input, and its return values include
data that is displayed by the presentation in response to the request. Conse-
quently, in order to design a POJO façade, we need to understand the presenta-
tion tier's requirements.
The presentation tier in a web application handles HTTP requests and gener-
ates HTTP responses. An HTTP request is sent by the browser when the user clicks
on a link or submits a form. Some HTTP requests might be handled entirely by the
presentation tier, but most requests result in a call to the business tier to update
the database or to retrieve data. The HTTP response is typically an HTML page but
could also be data for a rich client using a technology such as Ajax [Crane 2005]
that runs in the browser.
To determine the methods that a POJO façade must provide, you need to know
the requests that are handled by the presentation tier. The presentation tier calls a
POJO façade method, passing as arguments the user's input and any session state
stored in the presentation tier or the browser. The POJO façade must return the data
that the presentation tier needs to display the page along with any updated session
 
 
 
 
 
Search WWH ::




Custom Search