SlideShare a Scribd company logo
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Introduction to J2EE Patterns Online Training Classes
Design Patterns
•
A pattern is a proven solution to a problem in
a context.
•
Christopher Alexander says each pattern is a
three-part rule which expresses a relation
between a certain context, a problem, and a
solution.
•
Design patterns represent a solutions to
problems that arise when developing software
within a particular context.
www.quontrasolutions.com info@quontrasolutions.com
Categorizing Pattern
Patterns, then, represent expert solutions to
recurring problems in a context and thus have
been captured at many levels of abstraction
and in numerous domains. Numerous
categories are:
•
Design
•
Architectural
www.quontrasolutions.com info@quontrasolutions.com
MVC Design Pattern
•
Name (essence of the pattern)
– Model View Controller MVC
•
Context (where does this problem occur)
– MVC is an architectural pattern that is used when developing
interactive application such as a shopping cart on the Internet.
•
Problem (definition of the reoccurring difficulty)
– User interfaces change often, especially on the internet where look-
and-feel is a competitive issue. Also, the same information is
presented in different ways. The core business logic and data is
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
MVC Pattern
•
Solution (how do you solve the problem)
– Use the software engineering principle of “separation of concerns” to divide
the application into three areas:
•
Model encapsulates the core data and functionality
•
View encapsulates the presentation of the data there
can be many views of the common data
•
Controller accepts input from the user and makes
request from the model for the data to produce a
new view.
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
MVC Architecture
•
The Model represents the structure of the
data in the application, as well as application-
specific operations on those data.
•
A View (of which there may be many)
presents data in some form to a user, in the
context of some application function.
www.quontrasolutions.com info@quontrasolutions.com
Intercepting Filter
•
Context: The presentation-tier request
handling mechanism receives many different
types of requests, which require varied types
of processing before forwarding to handler.
•
Problem: Preprocessing and post-processing
of a client Web request and response are
required.
•
Solution: Create pluggable filters to process
common services in a standard manner
without requiring changes to core request
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.co.uk
Intercepting Filter
•
Used for common services such as security,
logging, debugging etc.
•
These filters are components that are
independent of the main application code.
•
Filters allow on the fly transformations of
payload and header of both the request into a
resource and the response from a resource.
www.quontrasolutions.com info@quontrasolutions.com
Writing a Filter
•
Implement the javax.servlet.Filter interface
•
Container will call the doFilter() method.
•
The doFilter method will modify the request or
response and then call the next filter in the
filter chain.
•
The FilterManager manages filter processing. It
creates the FilterChain with the appropriate
filters, in the correct order, and initiates
processing.
www.quontrasolutions.com info@quontrasolutions.com
Filter Configuration
•
Configuring filter in the deployment descriptor
( web.xml )
•
<filter>
•
<filter-name>Image Filter</filter-name>
•
<filter-class>com.acme.ImageFilter</filter-
class>
•
</filter>
•
<filter-mapping>
•
<filter-name>Image Filter</filter-name>
•
<url-pattern>/*</url-pattern>
www.quontrasolutions.com info@quontrasolutions.com
Interceptor Filter Pattern
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Filter: Sequence Diagram
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.co.uk
Front Controller
•
Context: The presentation-tier request
handling mechanism must control and
coordinate processing of each user across
multiple requests, in either a centralized or
decentralized manner.
•
Problem: The system requires a centralized
access point for presentation-tier request
handling to support the integration of system
services, content retrieval, view management,
and navigation.
www.quontrasolutions.com info@quontrasolutions.com
Front Controller
•
Solution: Use a controller as the initial point
of contact for handling a request.
•
The controller manages the handling of the
request, including invoking security services
such as authentication and authorization,
delegating business processing, managing the
choice of an appropriate view, handling
errors, and managing the selection of content
creation strategies.
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Front Controller
•
The controller provides a centralized entry
point that controls and manages Web request
handling.
•
Helps to reduce the code in form of scriptlets
in JSP page and promotes code reuse across
requests.
•
The Controller coordinates with a dispatcher
component for view management and
navigation.
www.quontrasolutions.com info@quontrasolutions.com
Front Controller Pattern
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Controller: Sequence Diagram
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
View Helper
•
Context: The system creates presentation
content, which requires processing of dynamic
business data.
•
Problem: Presentation tier changes occur
often and are difficult to develop and
maintain when business data access logic and
presentation formatting logic are interwoven.
•
This makes the system less flexible, less
reusable, and generally less resilient to change
www.quontrasolutions.co.uk info@quontrasolutions.co.uk
View Helper
•
Solution: A view contains formatting code,
delegating its processing responsibilities to its
helper classes, implemented as JavaBeans or
custom tags.
•
Helpers also store the view's intermediate
data model and serve as business data
adapters.
•
Encapsulating business logic in a helper
instead of a view makes our application more
modular and facilitates component reuse.
www.quontrasolutions.com info@quontrasolutions.com
View Helper Pattern
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
View Helper: Sequence Diagram
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Dispatcher View
•
Context: System controls flow of execution and
access to presentation processing, which is
responsible for generating dynamic content.
•
Problem: There is no centralized component
for managing access control, content retrieval
or view management, and there is duplicate
control code scattered throughout various
views.
Dispatcher View
•
Solution: Combine a controller and dispatcher
with views and helpers to handle client
requests and prepare a dynamic presentation
as the response.
•
Controllers do not delegate content retrieval
to helpers, because these activities are
deferred to the time of view processing.
•
A dispatcher is responsible for view
management and navigation and can be
encapsulated either within a controller, a
www.quontrasolutions.com info@quontrasolutions.com
Dispatcher View
•
Dispatcher pattern and the Service to Worker
pattern describe a similar structure.
•
Unlike the Service to Worker pattern, the
Dispatcher View pattern suggests deferring
content retrieval to the time of view
processing.
•
In the Dispatcher View pattern, the dispatcher
typically plays a limited to moderate role in
view management.
www.quontrasolutions.com info@quontrasolutions.com
Dispatcher View
•
A limited role for the dispatcher occurs when
no outside resources are utilized in order to
choose the view. For example:
•
http://some.server.com/servlet/Controller?
next=login.jsp
Dispatcher View Pattern
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Dispatcher View: Sequence
Diagram
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Service to Worker
•
Context: The system controls flow of
execution and access to business data, from
which it creates presentation content.
•
Problem: There is no centralized component
for managing access control, content retrieval,
or view management, and there is duplicate
control code scattered throughout various
views.
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Service to Worker
•
Solution: Combine a controller and dispatcher
with views and helpers to handle client
requests and prepare a dynamic presentation
as the response.
•
Controllers delegate content retrieval to
helpers, which manage the population of the
intermediate model for the view.
www.quontrasolutions.com info@quontrasolutions.com
Service to Worker
•
In the Service to Worker pattern, the
dispatcher typically plays a moderate to large
role in view management.
•
In Service to Worker pattern, the dispatcher
can be more sophisticated and may invoke a
business service to determine the appropriate
view to display.
•
The shared structure of Service to Worker and
Dispatcher View consists of a controller
www.quontrasolutions.com info@quontrasolutions.com
Service to Worker Pattern
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Service to Worker: Sequence
Diagram
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Business Delegate
•
Context: A multi-tiered, distributed system requires remote
method invocations to send and receive data across tiers. Clients
are exposed to the complexity of dealing with distributed
components.
•
Problem: Presentation-tier components interact directly with
business services, exposing the underlying implementation details
of the business service API to the presentation tier.
•
The presentation-tier components are vulnerable to changes in
implementation of the business services.
•
There is a detrimental impact on network performance because
presentation-tier components using the business service API make
too many invocations over the network, with no client-side caching
mechanism or aggregating service.
www.quontrasolutions.com info@quontrasolutions.com
Business Delegate
•
Solution: Use a Business Delegate to reduce
coupling between presentation-tier clients
and business services.
•
The Business Delegate hides the underlying
implementation details of the business
service, such as lookup and access details of
the EJB architecture.
•
Business Delegate reduces the coupling
between presentation-tier clients and the
system's business services, and other tiers.
www.quontrasolutions.com info@quontrasolutions.com
Business Delegate Pattern
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Business Delegate: Sequence Diagram
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Delegate: Sequence Diagram with ID
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Session Facade
•
Context: Enterprise beans encapsulate
business logic and business data and expose
their interfaces, and thus the complexity of
the distributed services, to the client tier.
•
Problem:
•
Tight coupling, which leads to direct
dependence between clients and business
objects;
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Session Facade: The Problem
•
The client must represent and implement the
complex interactions regarding business
object lookups and creations.
•
The client grows larger and more complex to
fulfill increasing requirements.
•
The client becomes very susceptible to
changes in the business object layer;
•
The client is unnecessarily exposed to the
underlying complexity of the system.
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Session Facade
•
Solution: Use a session bean as a facade to
encapsulate the complexity of interactions
between the business objects participating in
a workflow.
•
The Session Facade manages the business
objects, and provides a uniform coarse-
grained service access layer to clients.
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Session Facade
•
The session bean (representing the Session
Facade) manages the relationships between
business objects.
•
The session bean also manages the life cycle
of these participants by creating, locating
(looking up), modifying, and deleting them as
required by the workflow.
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Session Facade Pattern
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Session Facade: Sequence Diagram
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Service Locator
•
Context: Service lookup and creation involves
complex interfaces and network operations.
•
Problem: The J2EE clients must either locate
the service component or create a new
component in order to interact with the
service components such as EJB and JMS.
•
The JNDI API enables clients to obtain an
initial context object that holds the
component name to object bindings and is
valid for the client session.
www.quontrasolutions.com info@quontrasolutions.com
Service Locator
•
Solution: Use a Service Locator object to
abstract all JNDI usage and to hide the
complexities of initial context creation, EJB
home object lookup, and EJB object re-
creation.
•
Multiple clients can reuse the Service Locator
object to reduce code complexity, provide a
single point of control, and improve
performance by providing a caching facility.
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Service Locator Pattern
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Service Locator: Sequence Diagram
Transfer Object Assembler
•
Context: The server-side business
components are implemented using session
beans, entity beans, DAOs etc.
•
Application clients frequently need to access
data that is composed from multiple objects.
•
Problem: Application clients typically require
the data for the model or parts of the model
to present to the user or to use for an
intermediate processing step before providing
some service.
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Transfer Object Assembler
•
A tight coupling between the client and the
distributed components of the model over the
network.
•
Client accesses the numerous distributed
components degrading the perfroamnce.
•
The client must reconstruct the model after
obtaining the model's parts from the
distributed components.
•
Changes to the model require changes to the
client as client tightly coupled to the model.
www.quontrasolutions.com info@quontrasolutions.com
Transfer Object Assembler
•
Solution: Use a Transfer Object Assembler to
build the required model or sub-model.
•
The Transfer Object Assembler uses Transfer
Objects to retrieve data from various business
objects and other objects that define the
model or part of the model.
•
Transfer Object Assembler constructs a
immutable composite Transfer Object that
represents data from different business
components for the model
www.quontrasolutions.com info@quontrasolutions.com
Transfer Object Assembler Pattern
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Transfer Object Assembler: Sequence
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Transfer Object
•
Context: Application clients need to exchange
data with enterprise beans.
•
Problem: Some methods exposed by the
business components return data to the
client.
•
The client invokes a business object's get
methods multiple times until it obtains all the
attribute values.
•
Every method call made to the business
www.quontrasolutions.com info@quontrasolutions.com
Transfer Object: Problem
•
In EJB application such remote invocations use
the network layer regardless of the proximity
of the client to the bean, creating a network
overhead.
•
As the usage of the remote methods
increases, application performance can
significantly degrade.
•
Therefore, using multiple calls to get methods
that return single attribute values is inefficient
for obtaining data values from an enterprise
bean.
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Transfer Object
•
Solution: Use a Transfer Object to encapsulate
the business data.
•
A single method call is used to send and
retrieve the Transfer Object.
•
When the client requests the enterprise bean
for the business data, the enterprise bean can
construct the Transfer Object, populate it with
its attribute values, and pass it by value to the
client.
Transfer Object Pattern
Transfer Object: Sequence
Diagram
Updater Transfer Object: Sequence
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Data Access Object
•
Context: Access to data varies depending on
the source of the data.
•
Access to persistent storage, such as
database, varies depending on type of storage
and the vendor implementation.
•
Problem: Persistent storage is implemented
with different mechanisms, with marked
differences in the APIs to access the different
persistent storage mechanisms.
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Data Access Object: Problem
•
Applications that need to access data from a
legacy or disparate system are often required
to use APIs that may be proprietary, creating a
direct dependency between application code
and data access code.
•
Including the connectivity and data access
code within these components introduces a
tight coupling between the components and
the data source implementation making it
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Data Access Object
•
Solution: Use a Data Access Object (DAO) to
abstract and encapsulate all access to the data
source.
•
The DAO manages the connection with the
data source to obtain and store data.
•
The DAO completely hides the data source
implementation details from its clients.
•
The DAO adapts to different storage schemes
without affecting its clients or business
components
Data Access Object Pattern
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
Data Access Object: Sequence Diagram
www.quontrasolutions.com info@quontrasolutions.com
info@quontrasolutions.com
www.quontrasolutions.com
For More Details Contact us
Quontra Solutions
info@quontrasolutions.com
info@quontrasolutions.com
Visit: http://Www.quontrasolutions.com
Email: info@quontrasoluitons.com
Call us: (404) 900 - 9988

More Related Content

PDF
Web flowpresentation
PPTX
Чурюканов Вячеслав, “Code simple, but not simpler”
PPTX
Salesforce Development Best Practices
PDF
Action-Domain-Responder: A Refinement of MVC
PPTX
Analizador de Mejores Practicas en Windows 2008
PPTX
Decision CAMP 2014 - Erik Marutian - Using rules-based gui framework to power...
PDF
An Introduction to the Model-View-Controller Pattern
PPT
Constructing Enterprise Applications
Web flowpresentation
Чурюканов Вячеслав, “Code simple, but not simpler”
Salesforce Development Best Practices
Action-Domain-Responder: A Refinement of MVC
Analizador de Mejores Practicas en Windows 2008
Decision CAMP 2014 - Erik Marutian - Using rules-based gui framework to power...
An Introduction to the Model-View-Controller Pattern
Constructing Enterprise Applications

Similar to Introduction to j2 ee patterns online training class (20)

PPTX
J2EE Patterns
PPTX
Spring Web Presentation 123143242341234234
PPTX
MVC architecture by Mohd.Awais on 18th Aug, 2017
PPTX
Getting started with MVC 5 and Visual Studio 2013
PPTX
Mcv design patterns
PPTX
MVC Framework
PPTX
Patterns
PDF
Asp 1a-aspnetmvc
PDF
Aspnetmvc 1
PDF
Asp 1-mvc introduction
PDF
06 Common Software Architectures (1).pdf
PPTX
Sitecore mvc
PPTX
Architectural Design & Patterns
PPTX
Mvc presentation
PPTX
4. Introduction to ASP.NET MVC - Part I
PPTX
What is ASP.NET MVC
PDF
Targeting Mobile Platform with MVC 4.0
PPTX
Mobile App Architectures & Coding guidelines
PPTX
J2EE Patterns
Spring Web Presentation 123143242341234234
MVC architecture by Mohd.Awais on 18th Aug, 2017
Getting started with MVC 5 and Visual Studio 2013
Mcv design patterns
MVC Framework
Patterns
Asp 1a-aspnetmvc
Aspnetmvc 1
Asp 1-mvc introduction
06 Common Software Architectures (1).pdf
Sitecore mvc
Architectural Design & Patterns
Mvc presentation
4. Introduction to ASP.NET MVC - Part I
What is ASP.NET MVC
Targeting Mobile Platform with MVC 4.0
Mobile App Architectures & Coding guidelines
Ad

More from QUONTRASOLUTIONS (20)

PPTX
Big data introduction by quontra solutions
PPTX
Java constructors
PPTX
Cognos Online Training with placement Assistance - QuontraSolutions
PDF
Business analyst overview by quontra solutions
PDF
Business analyst overview by quontra solutions
PPTX
Cognos Overview
PPTX
Hibernate online training
PPTX
Java j2eeTutorial
PPTX
Software Quality Assurance training by QuontraSolutions
PPT
Introduction to software quality assurance by QuontraSolutions
PPT
.Net introduction by Quontra Solutions
PPTX
Saas overview by quontra solutions
PPTX
Sharepoint taxonomy introduction us
PPTX
Introduction to the sharepoint 2013 userprofile service By Quontra
PPTX
Introduction to SharePoint 2013 REST API
PPTX
Performance Testing and OBIEE by QuontraSolutions
PPTX
Obiee introduction building reports by QuontraSolutions
PPTX
Sharepoint designer workflow by quontra us
PPT
Qa by quontra us
PPT
MSBI and Data WareHouse techniques by Quontra
Big data introduction by quontra solutions
Java constructors
Cognos Online Training with placement Assistance - QuontraSolutions
Business analyst overview by quontra solutions
Business analyst overview by quontra solutions
Cognos Overview
Hibernate online training
Java j2eeTutorial
Software Quality Assurance training by QuontraSolutions
Introduction to software quality assurance by QuontraSolutions
.Net introduction by Quontra Solutions
Saas overview by quontra solutions
Sharepoint taxonomy introduction us
Introduction to the sharepoint 2013 userprofile service By Quontra
Introduction to SharePoint 2013 REST API
Performance Testing and OBIEE by QuontraSolutions
Obiee introduction building reports by QuontraSolutions
Sharepoint designer workflow by quontra us
Qa by quontra us
MSBI and Data WareHouse techniques by Quontra
Ad

Recently uploaded (20)

PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PDF
Basic Mud Logging Guide for educational purpose
PPTX
Open Quiz Monsoon Mind Game Final Set.pptx
PDF
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
TR - Agricultural Crops Production NC III.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
01-Introduction-to-Information-Management.pdf
PPTX
Cardiovascular Pharmacology for pharmacy students.pptx
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
Open Quiz Monsoon Mind Game Prelims.pptx
PDF
Insiders guide to clinical Medicine.pdf
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
Anesthesia in Laparoscopic Surgery in India
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
Basic Mud Logging Guide for educational purpose
Open Quiz Monsoon Mind Game Final Set.pptx
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
TR - Agricultural Crops Production NC III.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
01-Introduction-to-Information-Management.pdf
Cardiovascular Pharmacology for pharmacy students.pptx
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Open Quiz Monsoon Mind Game Prelims.pptx
Insiders guide to clinical Medicine.pdf
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Abdominal Access Techniques with Prof. Dr. R K Mishra
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
Microbial disease of the cardiovascular and lymphatic systems
Mark Klimek Lecture Notes_240423 revision books _173037.pdf

Introduction to j2 ee patterns online training class

  • 2. Design Patterns • A pattern is a proven solution to a problem in a context. • Christopher Alexander says each pattern is a three-part rule which expresses a relation between a certain context, a problem, and a solution. • Design patterns represent a solutions to problems that arise when developing software within a particular context. www.quontrasolutions.com info@quontrasolutions.com
  • 3. Categorizing Pattern Patterns, then, represent expert solutions to recurring problems in a context and thus have been captured at many levels of abstraction and in numerous domains. Numerous categories are: • Design • Architectural www.quontrasolutions.com info@quontrasolutions.com
  • 4. MVC Design Pattern • Name (essence of the pattern) – Model View Controller MVC • Context (where does this problem occur) – MVC is an architectural pattern that is used when developing interactive application such as a shopping cart on the Internet. • Problem (definition of the reoccurring difficulty) – User interfaces change often, especially on the internet where look- and-feel is a competitive issue. Also, the same information is presented in different ways. The core business logic and data is www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 5. MVC Pattern • Solution (how do you solve the problem) – Use the software engineering principle of “separation of concerns” to divide the application into three areas: • Model encapsulates the core data and functionality • View encapsulates the presentation of the data there can be many views of the common data • Controller accepts input from the user and makes request from the model for the data to produce a new view. www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 6. MVC Architecture • The Model represents the structure of the data in the application, as well as application- specific operations on those data. • A View (of which there may be many) presents data in some form to a user, in the context of some application function. www.quontrasolutions.com info@quontrasolutions.com
  • 7. Intercepting Filter • Context: The presentation-tier request handling mechanism receives many different types of requests, which require varied types of processing before forwarding to handler. • Problem: Preprocessing and post-processing of a client Web request and response are required. • Solution: Create pluggable filters to process common services in a standard manner without requiring changes to core request www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.co.uk
  • 8. Intercepting Filter • Used for common services such as security, logging, debugging etc. • These filters are components that are independent of the main application code. • Filters allow on the fly transformations of payload and header of both the request into a resource and the response from a resource. www.quontrasolutions.com info@quontrasolutions.com
  • 9. Writing a Filter • Implement the javax.servlet.Filter interface • Container will call the doFilter() method. • The doFilter method will modify the request or response and then call the next filter in the filter chain. • The FilterManager manages filter processing. It creates the FilterChain with the appropriate filters, in the correct order, and initiates processing. www.quontrasolutions.com info@quontrasolutions.com
  • 10. Filter Configuration • Configuring filter in the deployment descriptor ( web.xml ) • <filter> • <filter-name>Image Filter</filter-name> • <filter-class>com.acme.ImageFilter</filter- class> • </filter> • <filter-mapping> • <filter-name>Image Filter</filter-name> • <url-pattern>/*</url-pattern> www.quontrasolutions.com info@quontrasolutions.com
  • 11. Interceptor Filter Pattern www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 12. Filter: Sequence Diagram www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.co.uk
  • 13. Front Controller • Context: The presentation-tier request handling mechanism must control and coordinate processing of each user across multiple requests, in either a centralized or decentralized manner. • Problem: The system requires a centralized access point for presentation-tier request handling to support the integration of system services, content retrieval, view management, and navigation. www.quontrasolutions.com info@quontrasolutions.com
  • 14. Front Controller • Solution: Use a controller as the initial point of contact for handling a request. • The controller manages the handling of the request, including invoking security services such as authentication and authorization, delegating business processing, managing the choice of an appropriate view, handling errors, and managing the selection of content creation strategies. www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 15. Front Controller • The controller provides a centralized entry point that controls and manages Web request handling. • Helps to reduce the code in form of scriptlets in JSP page and promotes code reuse across requests. • The Controller coordinates with a dispatcher component for view management and navigation. www.quontrasolutions.com info@quontrasolutions.com
  • 16. Front Controller Pattern www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 17. Controller: Sequence Diagram www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 18. View Helper • Context: The system creates presentation content, which requires processing of dynamic business data. • Problem: Presentation tier changes occur often and are difficult to develop and maintain when business data access logic and presentation formatting logic are interwoven. • This makes the system less flexible, less reusable, and generally less resilient to change www.quontrasolutions.co.uk info@quontrasolutions.co.uk
  • 19. View Helper • Solution: A view contains formatting code, delegating its processing responsibilities to its helper classes, implemented as JavaBeans or custom tags. • Helpers also store the view's intermediate data model and serve as business data adapters. • Encapsulating business logic in a helper instead of a view makes our application more modular and facilitates component reuse. www.quontrasolutions.com info@quontrasolutions.com
  • 20. View Helper Pattern www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 21. View Helper: Sequence Diagram www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 22. Dispatcher View • Context: System controls flow of execution and access to presentation processing, which is responsible for generating dynamic content. • Problem: There is no centralized component for managing access control, content retrieval or view management, and there is duplicate control code scattered throughout various views.
  • 23. Dispatcher View • Solution: Combine a controller and dispatcher with views and helpers to handle client requests and prepare a dynamic presentation as the response. • Controllers do not delegate content retrieval to helpers, because these activities are deferred to the time of view processing. • A dispatcher is responsible for view management and navigation and can be encapsulated either within a controller, a www.quontrasolutions.com info@quontrasolutions.com
  • 24. Dispatcher View • Dispatcher pattern and the Service to Worker pattern describe a similar structure. • Unlike the Service to Worker pattern, the Dispatcher View pattern suggests deferring content retrieval to the time of view processing. • In the Dispatcher View pattern, the dispatcher typically plays a limited to moderate role in view management. www.quontrasolutions.com info@quontrasolutions.com
  • 25. Dispatcher View • A limited role for the dispatcher occurs when no outside resources are utilized in order to choose the view. For example: • http://some.server.com/servlet/Controller? next=login.jsp
  • 26. Dispatcher View Pattern www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 27. Dispatcher View: Sequence Diagram www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 28. Service to Worker • Context: The system controls flow of execution and access to business data, from which it creates presentation content. • Problem: There is no centralized component for managing access control, content retrieval, or view management, and there is duplicate control code scattered throughout various views. www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 29. Service to Worker • Solution: Combine a controller and dispatcher with views and helpers to handle client requests and prepare a dynamic presentation as the response. • Controllers delegate content retrieval to helpers, which manage the population of the intermediate model for the view. www.quontrasolutions.com info@quontrasolutions.com
  • 30. Service to Worker • In the Service to Worker pattern, the dispatcher typically plays a moderate to large role in view management. • In Service to Worker pattern, the dispatcher can be more sophisticated and may invoke a business service to determine the appropriate view to display. • The shared structure of Service to Worker and Dispatcher View consists of a controller www.quontrasolutions.com info@quontrasolutions.com
  • 31. Service to Worker Pattern www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 32. Service to Worker: Sequence Diagram www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 33. Business Delegate • Context: A multi-tiered, distributed system requires remote method invocations to send and receive data across tiers. Clients are exposed to the complexity of dealing with distributed components. • Problem: Presentation-tier components interact directly with business services, exposing the underlying implementation details of the business service API to the presentation tier. • The presentation-tier components are vulnerable to changes in implementation of the business services. • There is a detrimental impact on network performance because presentation-tier components using the business service API make too many invocations over the network, with no client-side caching mechanism or aggregating service. www.quontrasolutions.com info@quontrasolutions.com
  • 34. Business Delegate • Solution: Use a Business Delegate to reduce coupling between presentation-tier clients and business services. • The Business Delegate hides the underlying implementation details of the business service, such as lookup and access details of the EJB architecture. • Business Delegate reduces the coupling between presentation-tier clients and the system's business services, and other tiers. www.quontrasolutions.com info@quontrasolutions.com
  • 35. Business Delegate Pattern www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 36. Business Delegate: Sequence Diagram www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 37. Delegate: Sequence Diagram with ID www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 38. Session Facade • Context: Enterprise beans encapsulate business logic and business data and expose their interfaces, and thus the complexity of the distributed services, to the client tier. • Problem: • Tight coupling, which leads to direct dependence between clients and business objects; www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 39. Session Facade: The Problem • The client must represent and implement the complex interactions regarding business object lookups and creations. • The client grows larger and more complex to fulfill increasing requirements. • The client becomes very susceptible to changes in the business object layer; • The client is unnecessarily exposed to the underlying complexity of the system. www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 40. Session Facade • Solution: Use a session bean as a facade to encapsulate the complexity of interactions between the business objects participating in a workflow. • The Session Facade manages the business objects, and provides a uniform coarse- grained service access layer to clients. www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 41. Session Facade • The session bean (representing the Session Facade) manages the relationships between business objects. • The session bean also manages the life cycle of these participants by creating, locating (looking up), modifying, and deleting them as required by the workflow. www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 42. Session Facade Pattern www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 43. Session Facade: Sequence Diagram www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 44. Service Locator • Context: Service lookup and creation involves complex interfaces and network operations. • Problem: The J2EE clients must either locate the service component or create a new component in order to interact with the service components such as EJB and JMS. • The JNDI API enables clients to obtain an initial context object that holds the component name to object bindings and is valid for the client session. www.quontrasolutions.com info@quontrasolutions.com
  • 45. Service Locator • Solution: Use a Service Locator object to abstract all JNDI usage and to hide the complexities of initial context creation, EJB home object lookup, and EJB object re- creation. • Multiple clients can reuse the Service Locator object to reduce code complexity, provide a single point of control, and improve performance by providing a caching facility. www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 46. Service Locator Pattern www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 48. Transfer Object Assembler • Context: The server-side business components are implemented using session beans, entity beans, DAOs etc. • Application clients frequently need to access data that is composed from multiple objects. • Problem: Application clients typically require the data for the model or parts of the model to present to the user or to use for an intermediate processing step before providing some service. www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 49. Transfer Object Assembler • A tight coupling between the client and the distributed components of the model over the network. • Client accesses the numerous distributed components degrading the perfroamnce. • The client must reconstruct the model after obtaining the model's parts from the distributed components. • Changes to the model require changes to the client as client tightly coupled to the model. www.quontrasolutions.com info@quontrasolutions.com
  • 50. Transfer Object Assembler • Solution: Use a Transfer Object Assembler to build the required model or sub-model. • The Transfer Object Assembler uses Transfer Objects to retrieve data from various business objects and other objects that define the model or part of the model. • Transfer Object Assembler constructs a immutable composite Transfer Object that represents data from different business components for the model www.quontrasolutions.com info@quontrasolutions.com
  • 51. Transfer Object Assembler Pattern www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 52. Transfer Object Assembler: Sequence www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 53. Transfer Object • Context: Application clients need to exchange data with enterprise beans. • Problem: Some methods exposed by the business components return data to the client. • The client invokes a business object's get methods multiple times until it obtains all the attribute values. • Every method call made to the business www.quontrasolutions.com info@quontrasolutions.com
  • 54. Transfer Object: Problem • In EJB application such remote invocations use the network layer regardless of the proximity of the client to the bean, creating a network overhead. • As the usage of the remote methods increases, application performance can significantly degrade. • Therefore, using multiple calls to get methods that return single attribute values is inefficient for obtaining data values from an enterprise bean. www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 55. Transfer Object • Solution: Use a Transfer Object to encapsulate the business data. • A single method call is used to send and retrieve the Transfer Object. • When the client requests the enterprise bean for the business data, the enterprise bean can construct the Transfer Object, populate it with its attribute values, and pass it by value to the client.
  • 58. Updater Transfer Object: Sequence www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 59. Data Access Object • Context: Access to data varies depending on the source of the data. • Access to persistent storage, such as database, varies depending on type of storage and the vendor implementation. • Problem: Persistent storage is implemented with different mechanisms, with marked differences in the APIs to access the different persistent storage mechanisms. www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 60. Data Access Object: Problem • Applications that need to access data from a legacy or disparate system are often required to use APIs that may be proprietary, creating a direct dependency between application code and data access code. • Including the connectivity and data access code within these components introduces a tight coupling between the components and the data source implementation making it www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 61. Data Access Object • Solution: Use a Data Access Object (DAO) to abstract and encapsulate all access to the data source. • The DAO manages the connection with the data source to obtain and store data. • The DAO completely hides the data source implementation details from its clients. • The DAO adapts to different storage schemes without affecting its clients or business components
  • 62. Data Access Object Pattern www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 63. Data Access Object: Sequence Diagram www.quontrasolutions.com info@quontrasolutions.com info@quontrasolutions.com
  • 64. www.quontrasolutions.com For More Details Contact us Quontra Solutions info@quontrasolutions.com info@quontrasolutions.com Visit: http://Www.quontrasolutions.com Email: info@quontrasoluitons.com Call us: (404) 900 - 9988