Lec2 ecom fall16

48
e-Commerce Systems Zainab KHALLOUF, Ph.D. Lecture 2 e-Commerce Systems Implementing Java EE 7 Distributed Multi-Tiered E-Commerce Application Fall 2016

Transcript of Lec2 ecom fall16

Page 1: Lec2 ecom fall16

e-Commerce Systems

Zainab KHALLOUF, Ph.D.

Lecture 2e-Commerce Systems

Implementing Java EE 7 Distributed Multi-Tiered E-Commerce Application

Fall 2016

Page 2: Lec2 ecom fall16

References

Books:

The Java EE 7 Tutorial.

http://docs.oracle.com/javaee/7/tutorial/doc/javaeetutorial7.pdf

Courses sites

Mutli Tier Applications with Java EE, Berne University of Applied Sciences Engineering

and Information Technology, lecture notes by Prof. Dr. Eric Dubuis.https://prof.hti.bfh.ch/

Sites:

http://netbeans.org/

Acknowledgments:

Pr. Dr. Didier Donzes.

http://membres-liglab.imag.fr/donsez/

Page 3: Lec2 ecom fall16

Outline

Overview of Java EE Distributed Multitiered Applications.

Java EE Applications Components.

Java EE Servers.

Overview of MVC (Model View Controller) design pattern:One of the Java EE Design Patterns.

E-Commerce Systems 3

Page 4: Lec2 ecom fall16

Overview of Java EE Distributed MultitieredApplications

The Java EE platform provides developers with a powerfulset of APIs to program and deploy distributed multitieredapplications for enterprise.

Application logic is divided into components according tofunction, and these components are installed on variousmachines, depending on the tier in the multitiered Java EEenvironment to which the application component belongs.

A Java EE component is a self-contained functionalsoftware unit that is assembled into a Java EE applicationand that communicates with other components.

The Java EE 7 Tutorial.

http://docs.oracle.com/javaee/7/tutorial/doc/javaeetutorial7.pdf

E-Commerce Systems 4

Page 5: Lec2 ecom fall16

Overview of Java EE Distributed MultitieredApplications (cont.)

The Java EE 7 Tutorial.

http://docs.oracle.com/javaee/7/tutorial/doc/javaeetutorial7.pdf

E-Commerce Systems 5

Page 6: Lec2 ecom fall16

Overview of Java EE Distributed MultitieredApplications (cont.)

Java EE multitiered applications are generally consideredto be three-tiered applications because they are distributedover three locations:

Client machines.The Java EE server machine.The database or legacy machines.

E-Commerce Systems 6

Page 7: Lec2 ecom fall16

Java EE Applications Components

Java EE applications are made up of the followingcomponents:

Client-tier components run on the client machine (e.g.Dynamic web pages generated by web components runningin the web tier, application clients and applets...).

The Java EE 7 Tutorial.

http://docs.oracle.com/javaee/7/tutorial/doc/javaeetutorial7.pdf

E-Commerce Systems 7

Page 8: Lec2 ecom fall16

Java EE Applications Components (cont.)

Web-tier components run on the Java EE server and handlethe interaction between clients and the business tier.The following Java EE technologies are used in the web tierin Java EE applications: Java Servlet, JavaServer Faces,JavaServer Pages (JSP), JavaBeans ComponentsIts primary tasks are the following:

Dynamically generate content in various formats for theclient.Collect input from users of the client interface and returnappropriate results from the components in the businesstier.Control the flow of screens or pages on the client.Maintain the state of data for a user’s session.Perform some basic logic and hold some data temporarilyin JavaBeans components.

The Java EE 7 Tutorial.

http://docs.oracle.com/javaee/7/tutorial/doc/javaeetutorial7.pdf

E-Commerce Systems 8

Page 9: Lec2 ecom fall16

Java EE Applications Components (cont.)

Business-tier components run on the Java EE server andprovide the business logic (i.e. the code that provides corefunctionality) for an application.The following Java EE technologies are used in the businesstier in Java EE applications: Enterprise JavaBeans(enterprise bean) components, JAX-RS RESTful webservices, JAX-WS web service endpoints, Java PersistenceAPI entities.Enterprise information system (EIS)-tier software runs onthe EIS server (e.g. Database and Legacy Systems).

The Java EE 7 Tutorial.

http://docs.oracle.com/javaee/7/tutorial/doc/javaeetutorial7.pdf

E-Commerce Systems 9

Page 10: Lec2 ecom fall16

Java EE Distributed Multitiered Application: JSF,EJB, JPA

In this course I’ll focus on this architecture:

E-Commerce Systems 10

Page 11: Lec2 ecom fall16

Java EE Distributed Multitiered Application: Example

http:

//netbeans.org/kb/docs/javaee/ecommerce

E-Commerce Systems 11

Page 12: Lec2 ecom fall16

Java EE Distributed Multitiered Application: Example(cont.)

E-Commerce Systems 12

Page 13: Lec2 ecom fall16

Java EE Distributed Multitiered Application: Example(cont.)

E-Commerce Systems 13

Page 14: Lec2 ecom fall16

Advantages of Multitiers

Tiers separate functionality: Presentation logic, businesslogic, and data schema.Easier upgrade: Since one tier can be changed withoutchanging the rest.More extensible: New functionalities can be added moreeasily.

E-Commerce Systems 14

Page 15: Lec2 ecom fall16

Java EE Servers

A Java EE server is a server application that implementsthe Java EE platform APIs and provides the standard JavaEE services. Java EE servers are sometimes calledapplication servers.

Java EE server host several application component types.

The Java EE server provides services to these componentsin the form of a containers.

E-Commerce Systems 15

Page 16: Lec2 ecom fall16

Java EE Containers Types

http://netbeans.org/kb/docs/javaee/ecommerce/entity-session.html

E-Commerce Systems 16

Page 17: Lec2 ecom fall16

Java EE Application Servers

Page 18: Lec2 ecom fall16

WildFly

Formerly known as JBoss AS, or simply JBoss, is anapplication server authored by JBoss, now developed byRed Hat.

GNU Lesser General Public License(LGPL).

E-Commerce Systems 18

Page 19: Lec2 ecom fall16

JONAS AS

http://wiki.jonas.ow2.org/

LGPL

E-Commerce Systems 19

Page 20: Lec2 ecom fall16

GlassFish AS

http://glassfish.dev.java.net/

Common Development and Distribution License/GPL

E-Commerce Systems 20

Page 21: Lec2 ecom fall16

Other Java EE ASs

IBM Websphere (Proprietary).

Oracle BEA Weblogic (Proprietary).

E-Commerce Systems 21

Page 22: Lec2 ecom fall16

Overview of MVC (Model View Controller) design pattern: oneof the Java EE Design Patterns.

Page 23: Lec2 ecom fall16

What are Design Patterns?

A design pattern is a general reusable solution to a commonlyoccurring problem in software design. A design pattern is not afinished design that can be transformed directly into code. It isa description or template for how to solve a problem that canbe used in many different situations. Object-oriented designpatterns typically show relationships and interactions betweenclasses or objects, without specifying the final applicationclasses or objects that are involved.

Book of Gang of Four (GoF)

E-Commerce Systems 23

Page 24: Lec2 ecom fall16

Why studying patterns ?

Develop better products.

Learn from others experience.

Don’t reinvent the wheel.

E-Commerce Systems 24

Page 25: Lec2 ecom fall16

Why studying patterns ?

Develop better products.

Learn from others experience.

Don’t reinvent the wheel.

E-Commerce Systems 25

Page 26: Lec2 ecom fall16

Why studying patterns ?

Develop better products.

Learn from others experience.

Don’t reinvent the wheel.

E-Commerce Systems 26

Page 27: Lec2 ecom fall16

MVC (Model View Controller) Design Pattern

Page 28: Lec2 ecom fall16

Web Model 1

Page 29: Lec2 ecom fall16

Web Model 1

JSP page processes request and returns response to client

E-Commerce Systems 29

Page 30: Lec2 ecom fall16

Web Model 1 Limitations

Uses much scriplet code in JSP.

Tends not to be modular.

Boundaries of responsibility are still unclear.

E-Commerce Systems 30

Page 31: Lec2 ecom fall16

Web Model 1 Limitations

Uses much scriplet code in JSP.

Tends not to be modular.

Boundaries of responsibility are still unclear.

E-Commerce Systems 31

Page 32: Lec2 ecom fall16

Web Model 1 Limitations

Uses much scriplet code in JSP.

Tends not to be modular.

Boundaries of responsibility are still unclear.

E-Commerce Systems 32

Page 33: Lec2 ecom fall16

Web Model 1 Demonstration.

www.agiledeveloper.com/articles/JSPMVC.pdf

Page 34: Lec2 ecom fall16

MVC (Model-View-Controller)

E-Commerce Systems 34

Page 35: Lec2 ecom fall16

The Model

Provide access to business data and logic to manipulatedata.

Notifies views when it changes.

Provides the ability for the view to query the model aboutits state.

Provides the ability for the controller to access applicationfunctionality.

Model components can be implemented as JavaBeans,Enterprise JavaBeans (EJBs) and a range of other options.

E-Commerce Systems 35

Page 36: Lec2 ecom fall16

The Model

Provide access to business data and logic to manipulatedata.

Notifies views when it changes.

Provides the ability for the view to query the model aboutits state.

Provides the ability for the controller to access applicationfunctionality.

Model components can be implemented as JavaBeans,Enterprise JavaBeans (EJBs) and a range of other options.

E-Commerce Systems 36

Page 37: Lec2 ecom fall16

The Model

Provide access to business data and logic to manipulatedata.

Notifies views when it changes.

Provides the ability for the view to query the model aboutits state.

Provides the ability for the controller to access applicationfunctionality.

Model components can be implemented as JavaBeans,Enterprise JavaBeans (EJBs) and a range of other options.

E-Commerce Systems 37

Page 38: Lec2 ecom fall16

The Model

Provide access to business data and logic to manipulatedata.

Notifies views when it changes.

Provides the ability for the view to query the model aboutits state.

Provides the ability for the controller to access applicationfunctionality.

Model components can be implemented as JavaBeans,Enterprise JavaBeans (EJBs) and a range of other options.

E-Commerce Systems 38

Page 39: Lec2 ecom fall16

The Model

Provide access to business data and logic to manipulatedata.

Notifies views when it changes.

Provides the ability for the view to query the model aboutits state.

Provides the ability for the controller to access applicationfunctionality.

Model components can be implemented as JavaBeans,Enterprise JavaBeans (EJBs) and a range of other options.

E-Commerce Systems 39

Page 40: Lec2 ecom fall16

View Components

Renders the contents of a model.

Typically simple JSPs or HTML pages.

Open to future presentation technologies.

E-Commerce Systems 40

Page 41: Lec2 ecom fall16

View Components

Renders the contents of a model.

Typically simple JSPs or HTML pages.

Open to future presentation technologies.

E-Commerce Systems 41

Page 42: Lec2 ecom fall16

View Components

Renders the contents of a model.

Typically simple JSPs or HTML pages.

Open to future presentation technologies.

E-Commerce Systems 42

Page 43: Lec2 ecom fall16

Controller Components

Dispatches user requests.

Selects views for presentation.

interprets user inputs and maps them into actions to beperformed by the model.

E-Commerce Systems 43

Page 44: Lec2 ecom fall16

Controller Components

Dispatches user requests.

Selects views for presentation.

interprets user inputs and maps them into actions to beperformed by the model.

E-Commerce Systems 44

Page 45: Lec2 ecom fall16

Controller Components

Dispatches user requests.

Selects views for presentation.

interprets user inputs and maps them into actions to beperformed by the model.

E-Commerce Systems 45

Page 46: Lec2 ecom fall16

MVC Demonstration.

www.agiledeveloper.com/articles/JSPMVC.pdf

Page 47: Lec2 ecom fall16

MVC Frameworks

Struts.

Spring MVC http://www.springsource.org/.

Java Server Pages (JSF).

E-Commerce Systems 47

Page 48: Lec2 ecom fall16

Questions?