SlideShare una empresa de Scribd logo
1 de 23
J2EE Pattern - 5
By,
D. B. Naga Muruga,
Dept of Mechanical Engineering,
Sriram Engineering College
MVC PATTERN
 Define MVC pattern
The Model/View/Controller(MVC) is an architecture design pattern. Model
means data, View means representation and Controller works on data and
representation. MVC focuses on decouple the triad relationships among data,
representation and controller.
Where to use & benefits
Application architecture design.
Any data related design, including non-visual application.
Decouple complex object to improve maintainability.
Increase object reusability.
Achieve design flexibility.
RELATED PATTERNS INCLUDE
 Almost all patterns can be used with MVC
Example of MVC pattern
Struts framework is the best example of MVC pattern
BUSINESS DELEGATE PATTERN
 Define business delegate pattern
An intermediate class decouples between presentation-tier clients and
business services.
Where to use & benefits
Simplify the complicated relationship.
Reduce coupling.
Cache results and references to remote business services.
Cut potentially costly round trips
Hide the underlying implementation details of business service.
RELATED PATTERNS
INCLUDEProxy combined to simplify the complexity.
COMPOSITE ENTITY
PATTERN Define composite entity pattern
Use a coarse-grained interface to manage interactions between fine-grained or coarse-grained and
dependent objects internally. The Composite Entity is a coarse-grained entity bean. It may be the
coarse-grained object or hold a reference to the coarse-grained object. Also known as Aggregate Entity.
Where to use & benefits
Combine coarse-grained object and its related dependent objects into a single entity bean.
Multiple clients share persistent objects.
Model a network of related business entities.
In both local and distributed environment, use remote entity beans to model dependent business
objects or fine-grained objects.
Improve performance by eliminating the parameter and return value serialization and data transmission
costs.
Eliminate inter-entity relationships
Improve manageability by reducing entity beans.
Improve network performance
Reduce database schema dependency
Increase object granularity
Facilitate composite transer object creation.
Overhead of multi-level dependent object graphs.
RELATED PATTERNS INCLUDE
Transfer Object used to return to client and also used to serialize
the coarse-grained and dependent objects tree, or part of the
tree, as required.
Session Facade used to manage the inter-entity-bean
relationships.
EXAMPLE OF COMPOSITE ENTITY PATTERN
Maybe any of the reader can help me with this
DATA ACCESS OBJECT PATTERN
 Define data access object pattern
Adapt a uniform interface to access multiple databases like relational,
unrelational, object-oriented, etc.
Where to use & benefits
Need to access multiple data sources like legacy systems, B2B, LDAP, and so
forth.
Lack of uniform APIs to address the requirements to access disparate systems.
Persistent storage APIs vary depending on the product vendor.
Adapt and encapsulate all access to the data source.
Hide the data source implementation details from its clients.
More portable and less code dependencies in components.
Solve differences in the APIs which is used to access different persistent storage
mechanisms.
Not useful for container-managed persistence.
RELATED PATTERNS
INCLUDE factory method -- used to deal with different data sources.
 abstract factory -- used to make an abstract layer of access to data
sources.
 transfer object -- used to transport data to and from its clients.
EXAMPLE OF DATA ACCESS OBJECT PATTERN
 See sun's code sample
FRONT CONTROLLER
Define Front controller pattern
Using a single component to process application requests.
Where to use & benefits
JSP or Servlet.
Design request handling component.
Channel all requests through a single controller.
Centralize request processing and view selection.
Reduce business logic in a view
Improve manageability of security
Promote code reuse across requests
Avoid code duplication
RELATED PATTERNS INCLUDE
 Command combined with multiple requests.
 Intercepting Filter both centralize control of certain types of request processing.
 Page Controller -- an alternative way.
EXAMPLE FRONT CONTROLLER PATTERN
 Design a servlet to deal with all the requests. (Just like struts
controller)
INTERCEPTING FILTER PATTERN
 Define Intercepting Filter Pattern
A pluggable component design to intercept incomming requests and outgoing responses,
provide common services in a standard manner (independently) without changing core
processing code.
Where to use & benefits
Logging and authentication.
Enhance security.
Add additional function to existing web application.
Decorate main process.
Debug.
Pre-processing or post-processing for specific clients.
Uncompress incoming request.
Convert input encoding schema.
Being added or removed transparently or declaratively and triggered automatically
Improve reusability
Deployment-time composability
Each filter is loosely coupled
Inefficient for information sharing.
EXAMPLE INTERCEPTING FILTER PATTERN
To create a basic filter, you need to:
implement Filter interface
implement doFilter method
call doFilter from FilterChain object
register the filter with the appropriate servlets and JSP pages
Mapping the filter to specific pages
disable the invoker servlet
General skeleton program
Front Control better suited to handling core processing.
Template good for template filter strategy
Decorator providing for dynamically pluggable wrappers.
Related patterns include
 import javax.servlet.*;
import javax.servlet.http.*;
public class MyFilter implements Filter {
public void doFilter(ServletRequest request,
ServletResponse resonse,
FilterChain chain)
throws ServletException, IOException {
//work on request and response
chain.doFilter(request, response);
}
public void init(FilterConfig config) throws ServletException {
//work on config
}
public void destroy() {
//work on clean up
}
}
Register and filter mapping
//in web.xml file
<web-app>
...
Before the servlet description
<filter>
<filter-name>MyFilter</filter-name>
<display-name>MyCoolFilter</display-name>
<description>This is my cool filter</description>
<filter-class>somePackage.MyFilter</filter-class>
<init-param>
<param-name>yyy</param-name>
<param-value>/xxx/zzz</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>MyFilter</filter-name>
<url-pattern>/xxx.jsp</url-pattern>
</filter-mapping>
<!-- also apply to another servlet -->
<filter-mapping>
<filter-name>MyFilter</filter-name>
<servlet-name>xxx</servlet-name>
</filter-mapping> ...
</web-app>
You may use filter mapping and servlet mapping in web.xml file to diable the invoker servlet to apply the filter.
SERVICE LOCATOR
Define Service Locator
Centralizing distributed service object lookups, providing a centralized
point of control, acting as a cache that eliminates redundant lookups.
Where to use & benefits
Lookup object in JNDI, RMI, JMS, etc.
Encapsulate any vendor-specific features of lookup process
Simplify the lookup process
Improve the performance
RELATED PATTERNS
INCLUDE Singlton combined with service locator to make sure only one
lookup object exists.
Example Service Locator
Use a container as cache to hold the lookup object. One application only
lookups same object once. Doing so will dramatically improve performance.
Make sure the container used is thread-safe.
TRANSFER OBJECT PATTERN
Define transfer Object Pattern
Using a serializable class to act as data carrier, grouping related
attributes, forming a composite value and working as a return
type from remote business method. Also known as Value object.
Where to use & benefits
Get related values from remote business method.
Fetch multiple value in one trip.
Decrease network traffic.
Minimize latency and server resource usage.
EXAMPLE OF TRANSFER OBJECT PATTERN
 In the J2EE server, the client tier may make several calls to retrieve data from
the enterprise bean. Even in the same machine, the every call from the client
tier to the server tier is a remote method call. Think about use Transfer Object
design pattern to retrieve related attributes and return a single object instead
of each call just for retrieving a single attribute value. The transfer object is
passed by value to the client. All calls to the transfer object instance are local
calls to the client, so such design saves a lot of network traffic.
Let's say that you have a remote banking system. If the user has five requests
one time, you should design your system to give response once, not five
times. You may need to group all return values from these five requests to an
object carrier and then return to client just once. Once the client program
receives the instance of this object, it invokes the accessors and gets value to
display. The total network traffic for one user just once.
J2EE pattern 5
J2EE pattern 5
J2EE pattern 5
J2EE pattern 5

Más contenido relacionado

La actualidad más candente

Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2wiradikusuma
 
Spring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topicsSpring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topicsGuy Nir
 
Struts 2 Overview
Struts 2 OverviewStruts 2 Overview
Struts 2 Overviewskill-guru
 
Apex and Virtual Private Database
Apex and Virtual Private DatabaseApex and Virtual Private Database
Apex and Virtual Private DatabaseJeffrey Kemp
 
Action-Domain-Responder: A Web-Specific Refinement of Model-View-Controller
Action-Domain-Responder: A Web-Specific Refinement of Model-View-ControllerAction-Domain-Responder: A Web-Specific Refinement of Model-View-Controller
Action-Domain-Responder: A Web-Specific Refinement of Model-View-ControllerPaul Jones
 
Java Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and ExampleJava Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and Examplekamal kotecha
 
Spring MVC Architecture Tutorial
Spring MVC Architecture TutorialSpring MVC Architecture Tutorial
Spring MVC Architecture TutorialJava Success Point
 

La actualidad más candente (20)

Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2
 
Day2
Day2Day2
Day2
 
Jsfsunum
JsfsunumJsfsunum
Jsfsunum
 
Spring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topicsSpring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topics
 
TY.BSc.IT Java QB U5
TY.BSc.IT Java QB U5TY.BSc.IT Java QB U5
TY.BSc.IT Java QB U5
 
Struts 2 Overview
Struts 2 OverviewStruts 2 Overview
Struts 2 Overview
 
Day6
Day6Day6
Day6
 
Apex and Virtual Private Database
Apex and Virtual Private DatabaseApex and Virtual Private Database
Apex and Virtual Private Database
 
Introduction to struts
Introduction to strutsIntroduction to struts
Introduction to struts
 
Struts2
Struts2Struts2
Struts2
 
Spring Core
Spring CoreSpring Core
Spring Core
 
Struts ppt 1
Struts ppt 1Struts ppt 1
Struts ppt 1
 
Facelets
FaceletsFacelets
Facelets
 
Spring core
Spring coreSpring core
Spring core
 
Action-Domain-Responder: A Web-Specific Refinement of Model-View-Controller
Action-Domain-Responder: A Web-Specific Refinement of Model-View-ControllerAction-Domain-Responder: A Web-Specific Refinement of Model-View-Controller
Action-Domain-Responder: A Web-Specific Refinement of Model-View-Controller
 
Oracle application-development-framework-best-practices
Oracle application-development-framework-best-practicesOracle application-development-framework-best-practices
Oracle application-development-framework-best-practices
 
Java Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and ExampleJava Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and Example
 
Struts Ppt 1
Struts Ppt 1Struts Ppt 1
Struts Ppt 1
 
Struts,Jsp,Servlet
Struts,Jsp,ServletStruts,Jsp,Servlet
Struts,Jsp,Servlet
 
Spring MVC Architecture Tutorial
Spring MVC Architecture TutorialSpring MVC Architecture Tutorial
Spring MVC Architecture Tutorial
 

Similar a J2EE pattern 5

Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To MvcVolkan Uzun
 
Server side programming bt0083
Server side programming bt0083Server side programming bt0083
Server side programming bt0083Divyam Pateriya
 
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on RailsMVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Railscodeinmotion
 
MVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVCMVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVCAnton Krasnoshchok
 
Gof design pattern
Gof design patternGof design pattern
Gof design patternnaveen kumar
 
Simple mvc4 prepared by gigin krishnan
Simple mvc4 prepared by gigin krishnanSimple mvc4 prepared by gigin krishnan
Simple mvc4 prepared by gigin krishnanGigin Krishnan
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Tuna Tore
 
springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892Tuna Tore
 
SaaS transformation with OCE - uEngineCloud
SaaS transformation with OCE - uEngineCloudSaaS transformation with OCE - uEngineCloud
SaaS transformation with OCE - uEngineClouduEngine Solutions
 
IRJET- Lightweight MVC Framework in PHP
IRJET- Lightweight MVC Framework in PHPIRJET- Lightweight MVC Framework in PHP
IRJET- Lightweight MVC Framework in PHPIRJET Journal
 
Struts 2-overview2
Struts 2-overview2Struts 2-overview2
Struts 2-overview2divzi1913
 
Microservices with .Net - NDC Sydney, 2016
Microservices with .Net - NDC Sydney, 2016Microservices with .Net - NDC Sydney, 2016
Microservices with .Net - NDC Sydney, 2016Richard Banks
 
Modern Database Development Oow2008 Lucas Jellema
Modern Database Development Oow2008 Lucas JellemaModern Database Development Oow2008 Lucas Jellema
Modern Database Development Oow2008 Lucas JellemaLucas Jellema
 
important struts interview questions
important struts interview questionsimportant struts interview questions
important struts interview questionssurendray
 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts frameworks4al_com
 
Integrating Servlets and JSP (The MVC Architecture)
Integrating Servlets and JSP  (The MVC Architecture)Integrating Servlets and JSP  (The MVC Architecture)
Integrating Servlets and JSP (The MVC Architecture)Amit Ranjan
 

Similar a J2EE pattern 5 (20)

MVC
MVCMVC
MVC
 
Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To Mvc
 
Server side programming bt0083
Server side programming bt0083Server side programming bt0083
Server side programming bt0083
 
Mvc
MvcMvc
Mvc
 
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on RailsMVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Rails
 
MVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVCMVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVC
 
Gof design pattern
Gof design patternGof design pattern
Gof design pattern
 
Simple mvc4 prepared by gigin krishnan
Simple mvc4 prepared by gigin krishnanSimple mvc4 prepared by gigin krishnan
Simple mvc4 prepared by gigin krishnan
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5
 
springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892
 
Spring mvc 2.0
Spring mvc 2.0Spring mvc 2.0
Spring mvc 2.0
 
SaaS transformation with OCE - uEngineCloud
SaaS transformation with OCE - uEngineCloudSaaS transformation with OCE - uEngineCloud
SaaS transformation with OCE - uEngineCloud
 
Struts Interceptors
Struts InterceptorsStruts Interceptors
Struts Interceptors
 
IRJET- Lightweight MVC Framework in PHP
IRJET- Lightweight MVC Framework in PHPIRJET- Lightweight MVC Framework in PHP
IRJET- Lightweight MVC Framework in PHP
 
Struts 2-overview2
Struts 2-overview2Struts 2-overview2
Struts 2-overview2
 
Microservices with .Net - NDC Sydney, 2016
Microservices with .Net - NDC Sydney, 2016Microservices with .Net - NDC Sydney, 2016
Microservices with .Net - NDC Sydney, 2016
 
Modern Database Development Oow2008 Lucas Jellema
Modern Database Development Oow2008 Lucas JellemaModern Database Development Oow2008 Lucas Jellema
Modern Database Development Oow2008 Lucas Jellema
 
important struts interview questions
important struts interview questionsimportant struts interview questions
important struts interview questions
 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts framework
 
Integrating Servlets and JSP (The MVC Architecture)
Integrating Servlets and JSP  (The MVC Architecture)Integrating Servlets and JSP  (The MVC Architecture)
Integrating Servlets and JSP (The MVC Architecture)
 

Más de Naga Muruga

CHAITANYA UNIVERSITY - BEST POSTER.pdf
CHAITANYA UNIVERSITY - BEST POSTER.pdfCHAITANYA UNIVERSITY - BEST POSTER.pdf
CHAITANYA UNIVERSITY - BEST POSTER.pdfNaga Muruga
 
AMET - BEST PRESENTATION.pdf
AMET - BEST PRESENTATION.pdfAMET - BEST PRESENTATION.pdf
AMET - BEST PRESENTATION.pdfNaga Muruga
 
DEvOpS, CI/CD For Beginners.pdf
DEvOpS, CI/CD For Beginners.pdfDEvOpS, CI/CD For Beginners.pdf
DEvOpS, CI/CD For Beginners.pdfNaga Muruga
 
API and Web Service Introduction .pdf
API and Web Service Introduction .pdfAPI and Web Service Introduction .pdf
API and Web Service Introduction .pdfNaga Muruga
 
Naga muruga resume
Naga muruga resumeNaga muruga resume
Naga muruga resumeNaga Muruga
 
Self Healing Materials - A Review
Self Healing Materials - A ReviewSelf Healing Materials - A Review
Self Healing Materials - A ReviewNaga Muruga
 
Fundamentals of Manuscript Preparation
Fundamentals of Manuscript PreparationFundamentals of Manuscript Preparation
Fundamentals of Manuscript PreparationNaga Muruga
 
Auto CAD (Beginner)
Auto CAD (Beginner)Auto CAD (Beginner)
Auto CAD (Beginner)Naga Muruga
 
Boilers, Types and Energy Efficiency
Boilers, Types and Energy EfficiencyBoilers, Types and Energy Efficiency
Boilers, Types and Energy EfficiencyNaga Muruga
 
Project Management Essentials
Project Management EssentialsProject Management Essentials
Project Management EssentialsNaga Muruga
 
Lean Six Sigma White Belt
Lean Six Sigma White BeltLean Six Sigma White Belt
Lean Six Sigma White BeltNaga Muruga
 
Basics of Drives and Motors
Basics of Drives and MotorsBasics of Drives and Motors
Basics of Drives and MotorsNaga Muruga
 
Anti juice jacking smart solar charger
Anti juice jacking smart solar chargerAnti juice jacking smart solar charger
Anti juice jacking smart solar chargerNaga Muruga
 
Top 32 technologies
Top 32 technologiesTop 32 technologies
Top 32 technologiesNaga Muruga
 
Controversy on feminism
Controversy on feminismControversy on feminism
Controversy on feminismNaga Muruga
 

Más de Naga Muruga (20)

CHAITANYA UNIVERSITY - BEST POSTER.pdf
CHAITANYA UNIVERSITY - BEST POSTER.pdfCHAITANYA UNIVERSITY - BEST POSTER.pdf
CHAITANYA UNIVERSITY - BEST POSTER.pdf
 
AMET - BEST PRESENTATION.pdf
AMET - BEST PRESENTATION.pdfAMET - BEST PRESENTATION.pdf
AMET - BEST PRESENTATION.pdf
 
Intro to Git
Intro to GitIntro to Git
Intro to Git
 
DEvOpS, CI/CD For Beginners.pdf
DEvOpS, CI/CD For Beginners.pdfDEvOpS, CI/CD For Beginners.pdf
DEvOpS, CI/CD For Beginners.pdf
 
API and Web Service Introduction .pdf
API and Web Service Introduction .pdfAPI and Web Service Introduction .pdf
API and Web Service Introduction .pdf
 
Naga muruga resume
Naga muruga resumeNaga muruga resume
Naga muruga resume
 
Self Healing Materials - A Review
Self Healing Materials - A ReviewSelf Healing Materials - A Review
Self Healing Materials - A Review
 
Fundamentals of Manuscript Preparation
Fundamentals of Manuscript PreparationFundamentals of Manuscript Preparation
Fundamentals of Manuscript Preparation
 
Auto CAD (Beginner)
Auto CAD (Beginner)Auto CAD (Beginner)
Auto CAD (Beginner)
 
Content Writing
Content WritingContent Writing
Content Writing
 
Boilers, Types and Energy Efficiency
Boilers, Types and Energy EfficiencyBoilers, Types and Energy Efficiency
Boilers, Types and Energy Efficiency
 
Project Management Essentials
Project Management EssentialsProject Management Essentials
Project Management Essentials
 
Lean Six Sigma White Belt
Lean Six Sigma White BeltLean Six Sigma White Belt
Lean Six Sigma White Belt
 
Basics of Drives and Motors
Basics of Drives and MotorsBasics of Drives and Motors
Basics of Drives and Motors
 
Supply Chain
Supply ChainSupply Chain
Supply Chain
 
Green walls
Green wallsGreen walls
Green walls
 
Anti juice jacking smart solar charger
Anti juice jacking smart solar chargerAnti juice jacking smart solar charger
Anti juice jacking smart solar charger
 
Top 32 technologies
Top 32 technologiesTop 32 technologies
Top 32 technologies
 
Controversy on feminism
Controversy on feminismControversy on feminism
Controversy on feminism
 
Unicef poster
Unicef posterUnicef poster
Unicef poster
 

Último

Turn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxTurn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxStephen Sitton
 
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTESCME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTESkarthi keyan
 
Levelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument methodLevelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument methodManicka Mamallan Andavar
 
Prach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism CommunityPrach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism Communityprachaibot
 
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书rnrncn29
 
Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________Romil Mishra
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionMebane Rash
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfDrew Moseley
 
OOP concepts -in-Python programming language
OOP concepts -in-Python programming languageOOP concepts -in-Python programming language
OOP concepts -in-Python programming languageSmritiSharma901052
 
System Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingSystem Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingBootNeck1
 
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSHigh Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSsandhya757531
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating SystemRashmi Bhat
 
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Erbil Polytechnic University
 
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.pptROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.pptJohnWilliam111370
 
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.elesangwon
 
Ch10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdfCh10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdfChristianCDAM
 
"Exploring the Essential Functions and Design Considerations of Spillways in ...
"Exploring the Essential Functions and Design Considerations of Spillways in ..."Exploring the Essential Functions and Design Considerations of Spillways in ...
"Exploring the Essential Functions and Design Considerations of Spillways in ...Erbil Polytechnic University
 
KCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosKCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosVictor Morales
 
Python Programming for basic beginners.pptx
Python Programming for basic beginners.pptxPython Programming for basic beginners.pptx
Python Programming for basic beginners.pptxmohitesoham12
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating SystemRashmi Bhat
 

Último (20)

Turn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxTurn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptx
 
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTESCME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
 
Levelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument methodLevelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument method
 
Prach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism CommunityPrach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism Community
 
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
 
Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of Action
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdf
 
OOP concepts -in-Python programming language
OOP concepts -in-Python programming languageOOP concepts -in-Python programming language
OOP concepts -in-Python programming language
 
System Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingSystem Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event Scheduling
 
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSHigh Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating System
 
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
 
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.pptROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
 
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
 
Ch10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdfCh10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdf
 
"Exploring the Essential Functions and Design Considerations of Spillways in ...
"Exploring the Essential Functions and Design Considerations of Spillways in ..."Exploring the Essential Functions and Design Considerations of Spillways in ...
"Exploring the Essential Functions and Design Considerations of Spillways in ...
 
KCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosKCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitos
 
Python Programming for basic beginners.pptx
Python Programming for basic beginners.pptxPython Programming for basic beginners.pptx
Python Programming for basic beginners.pptx
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating System
 

J2EE pattern 5

  • 1. J2EE Pattern - 5 By, D. B. Naga Muruga, Dept of Mechanical Engineering, Sriram Engineering College
  • 2. MVC PATTERN  Define MVC pattern The Model/View/Controller(MVC) is an architecture design pattern. Model means data, View means representation and Controller works on data and representation. MVC focuses on decouple the triad relationships among data, representation and controller. Where to use & benefits Application architecture design. Any data related design, including non-visual application. Decouple complex object to improve maintainability. Increase object reusability. Achieve design flexibility.
  • 3. RELATED PATTERNS INCLUDE  Almost all patterns can be used with MVC Example of MVC pattern Struts framework is the best example of MVC pattern
  • 4. BUSINESS DELEGATE PATTERN  Define business delegate pattern An intermediate class decouples between presentation-tier clients and business services. Where to use & benefits Simplify the complicated relationship. Reduce coupling. Cache results and references to remote business services. Cut potentially costly round trips Hide the underlying implementation details of business service.
  • 5. RELATED PATTERNS INCLUDEProxy combined to simplify the complexity.
  • 6. COMPOSITE ENTITY PATTERN Define composite entity pattern Use a coarse-grained interface to manage interactions between fine-grained or coarse-grained and dependent objects internally. The Composite Entity is a coarse-grained entity bean. It may be the coarse-grained object or hold a reference to the coarse-grained object. Also known as Aggregate Entity. Where to use & benefits Combine coarse-grained object and its related dependent objects into a single entity bean. Multiple clients share persistent objects. Model a network of related business entities. In both local and distributed environment, use remote entity beans to model dependent business objects or fine-grained objects. Improve performance by eliminating the parameter and return value serialization and data transmission costs. Eliminate inter-entity relationships Improve manageability by reducing entity beans. Improve network performance Reduce database schema dependency Increase object granularity Facilitate composite transer object creation. Overhead of multi-level dependent object graphs.
  • 7. RELATED PATTERNS INCLUDE Transfer Object used to return to client and also used to serialize the coarse-grained and dependent objects tree, or part of the tree, as required. Session Facade used to manage the inter-entity-bean relationships.
  • 8. EXAMPLE OF COMPOSITE ENTITY PATTERN Maybe any of the reader can help me with this
  • 9. DATA ACCESS OBJECT PATTERN  Define data access object pattern Adapt a uniform interface to access multiple databases like relational, unrelational, object-oriented, etc. Where to use & benefits Need to access multiple data sources like legacy systems, B2B, LDAP, and so forth. Lack of uniform APIs to address the requirements to access disparate systems. Persistent storage APIs vary depending on the product vendor. Adapt and encapsulate all access to the data source. Hide the data source implementation details from its clients. More portable and less code dependencies in components. Solve differences in the APIs which is used to access different persistent storage mechanisms. Not useful for container-managed persistence.
  • 10. RELATED PATTERNS INCLUDE factory method -- used to deal with different data sources.  abstract factory -- used to make an abstract layer of access to data sources.  transfer object -- used to transport data to and from its clients. EXAMPLE OF DATA ACCESS OBJECT PATTERN  See sun's code sample
  • 11. FRONT CONTROLLER Define Front controller pattern Using a single component to process application requests. Where to use & benefits JSP or Servlet. Design request handling component. Channel all requests through a single controller. Centralize request processing and view selection. Reduce business logic in a view Improve manageability of security Promote code reuse across requests Avoid code duplication
  • 12. RELATED PATTERNS INCLUDE  Command combined with multiple requests.  Intercepting Filter both centralize control of certain types of request processing.  Page Controller -- an alternative way. EXAMPLE FRONT CONTROLLER PATTERN  Design a servlet to deal with all the requests. (Just like struts controller)
  • 13. INTERCEPTING FILTER PATTERN  Define Intercepting Filter Pattern A pluggable component design to intercept incomming requests and outgoing responses, provide common services in a standard manner (independently) without changing core processing code. Where to use & benefits Logging and authentication. Enhance security. Add additional function to existing web application. Decorate main process. Debug. Pre-processing or post-processing for specific clients. Uncompress incoming request. Convert input encoding schema. Being added or removed transparently or declaratively and triggered automatically Improve reusability Deployment-time composability Each filter is loosely coupled Inefficient for information sharing.
  • 14. EXAMPLE INTERCEPTING FILTER PATTERN To create a basic filter, you need to: implement Filter interface implement doFilter method call doFilter from FilterChain object register the filter with the appropriate servlets and JSP pages Mapping the filter to specific pages disable the invoker servlet General skeleton program Front Control better suited to handling core processing. Template good for template filter strategy Decorator providing for dynamically pluggable wrappers. Related patterns include
  • 15.  import javax.servlet.*; import javax.servlet.http.*; public class MyFilter implements Filter { public void doFilter(ServletRequest request, ServletResponse resonse, FilterChain chain) throws ServletException, IOException { //work on request and response chain.doFilter(request, response); } public void init(FilterConfig config) throws ServletException { //work on config } public void destroy() { //work on clean up } } Register and filter mapping //in web.xml file <web-app> ... Before the servlet description <filter> <filter-name>MyFilter</filter-name> <display-name>MyCoolFilter</display-name> <description>This is my cool filter</description> <filter-class>somePackage.MyFilter</filter-class> <init-param> <param-name>yyy</param-name> <param-value>/xxx/zzz</param-value> </init-param> </filter> <filter-mapping> <filter-name>MyFilter</filter-name> <url-pattern>/xxx.jsp</url-pattern> </filter-mapping> <!-- also apply to another servlet --> <filter-mapping> <filter-name>MyFilter</filter-name> <servlet-name>xxx</servlet-name> </filter-mapping> ... </web-app> You may use filter mapping and servlet mapping in web.xml file to diable the invoker servlet to apply the filter.
  • 16. SERVICE LOCATOR Define Service Locator Centralizing distributed service object lookups, providing a centralized point of control, acting as a cache that eliminates redundant lookups. Where to use & benefits Lookup object in JNDI, RMI, JMS, etc. Encapsulate any vendor-specific features of lookup process Simplify the lookup process Improve the performance
  • 17. RELATED PATTERNS INCLUDE Singlton combined with service locator to make sure only one lookup object exists. Example Service Locator Use a container as cache to hold the lookup object. One application only lookups same object once. Doing so will dramatically improve performance. Make sure the container used is thread-safe.
  • 18. TRANSFER OBJECT PATTERN Define transfer Object Pattern Using a serializable class to act as data carrier, grouping related attributes, forming a composite value and working as a return type from remote business method. Also known as Value object. Where to use & benefits Get related values from remote business method. Fetch multiple value in one trip. Decrease network traffic. Minimize latency and server resource usage.
  • 19. EXAMPLE OF TRANSFER OBJECT PATTERN  In the J2EE server, the client tier may make several calls to retrieve data from the enterprise bean. Even in the same machine, the every call from the client tier to the server tier is a remote method call. Think about use Transfer Object design pattern to retrieve related attributes and return a single object instead of each call just for retrieving a single attribute value. The transfer object is passed by value to the client. All calls to the transfer object instance are local calls to the client, so such design saves a lot of network traffic. Let's say that you have a remote banking system. If the user has five requests one time, you should design your system to give response once, not five times. You may need to group all return values from these five requests to an object carrier and then return to client just once. Once the client program receives the instance of this object, it invokes the accessors and gets value to display. The total network traffic for one user just once.