Lec2 ecom fall16

Post on 27-Jan-2017

122 views 0 download

Transcript of 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

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/

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

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

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

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

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

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

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

Java EE Distributed Multitiered Application: JSF,EJB, JPA

In this course I’ll focus on this architecture:

E-Commerce Systems 10

Java EE Distributed Multitiered Application: Example

http:

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

E-Commerce Systems 11

Java EE Distributed Multitiered Application: Example(cont.)

E-Commerce Systems 12

Java EE Distributed Multitiered Application: Example(cont.)

E-Commerce Systems 13

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

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

Java EE Containers Types

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

E-Commerce Systems 16

Java EE Application Servers

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

JONAS AS

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

LGPL

E-Commerce Systems 19

GlassFish AS

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

Common Development and Distribution License/GPL

E-Commerce Systems 20

Other Java EE ASs

IBM Websphere (Proprietary).

Oracle BEA Weblogic (Proprietary).

E-Commerce Systems 21

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

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

Why studying patterns ?

Develop better products.

Learn from others experience.

Don’t reinvent the wheel.

E-Commerce Systems 24

Why studying patterns ?

Develop better products.

Learn from others experience.

Don’t reinvent the wheel.

E-Commerce Systems 25

Why studying patterns ?

Develop better products.

Learn from others experience.

Don’t reinvent the wheel.

E-Commerce Systems 26

MVC (Model View Controller) Design Pattern

Web Model 1

Web Model 1

JSP page processes request and returns response to client

E-Commerce Systems 29

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

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

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

Web Model 1 Demonstration.

www.agiledeveloper.com/articles/JSPMVC.pdf

MVC (Model-View-Controller)

E-Commerce Systems 34

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

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

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

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

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

View Components

Renders the contents of a model.

Typically simple JSPs or HTML pages.

Open to future presentation technologies.

E-Commerce Systems 40

View Components

Renders the contents of a model.

Typically simple JSPs or HTML pages.

Open to future presentation technologies.

E-Commerce Systems 41

View Components

Renders the contents of a model.

Typically simple JSPs or HTML pages.

Open to future presentation technologies.

E-Commerce Systems 42

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

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

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

MVC Demonstration.

www.agiledeveloper.com/articles/JSPMVC.pdf

MVC Frameworks

Struts.

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

Java Server Pages (JSF).

E-Commerce Systems 47

Questions?