point of sale(pos) j2ee application

28
Point Of Sale(POS) J2EE Application Department : Computer Science Degree : Master Student : Woojin Choi ID : 0426367 (POS J2EE Application with JRun) < Master Degree Final Project >

Upload: randolph-tripp

Post on 31-Dec-2015

73 views

Category:

Documents


1 download

DESCRIPTION

Point Of Sale(POS) J2EE Application. (POS J2EE Application with JRun). < Master Degree Final Project >. Department : Computer Science Degree : Master Student : Woojin Choi ID : 0426367. Topics. Introduction of POS Application System requirement Application Map Database Diagram - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Point Of Sale(POS) J2EE Application

Point Of Sale(POS) J2EE Application

Department : Computer ScienceDegree : MasterStudent : Woojin ChoiID : 0426367

(POS J2EE Application with JRun)

< Master Degree Final Project >

Page 2: Point Of Sale(POS) J2EE Application

Topics

Introduction of POS Application System requirement Application Map Database Diagram POS Component POS Workflow using J2EE Design HTML / JSP / Servlet / EJB in POS J2EE Introduction (J2EE – J2EE API) POS Application with J2EE Enterprise JavaBeans (EJB) POS Component Example POS Security Mechanism POS Scheduler Supplementary Issues

Page 3: Point Of Sale(POS) J2EE Application

Introduction of POS

POS : Point of Sale Business topic : Web based application for a customer to check out the

shopping easily and fast Current Process : Customer comes in store -> Put the item to shopping

cart -> Wait to check out -> Clerk help to check out Problem : Customers need to wait for a long time even the item is

simple Solution : Put the clerk barcode scanning and checking out systems to

each shopping lane and allow for a customer to check out the carts by himself

New system to solve the problem : POS J2EE Application Benefits : Portable business solution / Integrated e-business / Save the

customer’s time / Down the store cost

Page 4: Point Of Sale(POS) J2EE Application

System Requirement

Server side› Operating System : Win NT 4.0 / Win2K› Web Server : IIS 4.0 / 5.0› Application Server : JRun 3.0.2› Database : MS SQL Server 7.0

Client side› Browser : IE4.0 or higher

Page 5: Point Of Sale(POS) J2EE Application

Checkout.jspCheckout.jsp

Products.jspProducts.jsp

Add/Edit/DeleteShopping list

Add/Edit/DeleteShopping list

Login.jspLogin.jsp

Application Map

AuthenticationServlet

AuthenticationServlet

Loginerror.jspLoginerror.jsp

Index.jsp(Display shoppling cart)

Index.jsp(Display shoppling cart)

Logout.jspLogout.jsp

SchedulerScheduler

Customized Error PagesHTTP Error

Jrun Application Error403.html404.html405.html500.html

Loginerror.jsp

Customized Error PagesHTTP Error

Jrun Application Error403.html404.html405.html500.html

Loginerror.jsp

Page 6: Point Of Sale(POS) J2EE Application

Database Diagram

Page 7: Point Of Sale(POS) J2EE Application

POS Components

Presentation Logic › HTML› JSP› Login.jsp, customers.jsp, customer_profile.jsp, …

Interface Logic (Data Modeling)› Servlet› EditCustomer.class, DeleteCustomer.class,

AddShoppingList.class, … Business Logic

› EJB› Customer EJB, ShoppingList EJB, …

Page 8: Point Of Sale(POS) J2EE Application

POS Workflow using J2EE design

Presentation : JSP Interface : Servlet Business Logic : EJB Benefits : Presentation logic doesn’t implement

business logics at all. Every business data is updated through EJB or Servlets. Especially Servlet is reponsible for data modeling for business logic as interface between presentation and business logic.

JSPJSP ServletServlet<> EJB

ContainerEJB

Container DB

Page 9: Point Of Sale(POS) J2EE Application

HTML / JSP / Servlet / EJB in POS

JSPEngine

JSPEngine

ServletContainer

ServletContainer

HTTP

Ser

ver(H

TML)

HTTP

Ser

ver(H

TML)

HTTP

<>

JDBC

JDBC

EJBContainer

EJBContainer

JRun

HTTP on LAN

DB

Page 10: Point Of Sale(POS) J2EE Application

Defines a standard for developing multi-tier applications› Vendors collaborate on standards and compete on

implementation› All the pieces of the application are portable across platforms

and servers Simplifies application development

› Developer focuses on application logic› J2EE server handles complexity of lower level services

Component› JSPs / Servlets / EJBs

API : Servlet / JSP / EJB / JDBC / JNDI / JavaMail / JMS / JTA

Java 2 Enterprise Edition (J2EE)

Page 11: Point Of Sale(POS) J2EE Application

J2EE APIs

Servlets› Standard API extending and enhancing Web servers

Java Server Pages (JSP)› Standard API for creating dynamic content using static templates

Enterprise JavaBeans (EJB)› Standard server-side component model

Java Database Connectivity (JDBC) JavaMail Java Naming and Directory Interface (JNDI) Java Message Service (JMS) Java Transaction API (JTA)

*) POS system : Servlet / JSP / EJB / JNDI / JDBC

Page 12: Point Of Sale(POS) J2EE Application

POS Application with J2EE

Provides complete implementation of J2EE› Servlets 2.2› JSP 1.1› EJB 1.1› JNDI› JMS› JDBC› JTA/JTS› JavaMail

POS Application› Servlet 2.2› JSP 1.1› EJB 1.1› JNDI

POS Application Work Flow› Presentation : JSP› Interface : Servlet› Business Logic : EJB

Page 13: Point Of Sale(POS) J2EE Application

Enterprise JavaBeans (EJB)

Server-side component model allowing developers to concentrate on business logic

EJB server handles complexity of lower level services

EJB API guarantees components to be portable across EJB Servers

› Component life cycle› State management› Persistence› Multi-threading

› Connection pooling› Transaction management› Security

Page 14: Point Of Sale(POS) J2EE Application

Entity Beans

Used to› Represent a business entity (like a row in a

database table)› Provide standard access and validation for

business entities Persistent (live beyond server lifetime)

› Usually represent data in a database Examples

› Customer, Product, Employee, ...

Page 15: Point Of Sale(POS) J2EE Application

Entity Beans

Bean Managed Persistence (BMP)› Developer writes persistence code

Container Managed Persistence (CMP)› EJB properties are mapped to database columns› Persistence code automatically generated by EJB

container Implements javax.ejb.EntityBean

Page 16: Point Of Sale(POS) J2EE Application

Session Beans

Used to› Manage processes and tasks › Model the workflow of Entity beans› Retrieve and update data that can't be adequately captured

in an entity bean No persistent state Example

› Order a product› Check out the shopping cart› Reservation

Page 17: Point Of Sale(POS) J2EE Application

Session Beans

Stateful Session Bean› Maintain a state between method invocations› Store properties as instance variables› Expose methods to manipulate properties

Stateless Session Bean› Do not retain information between method invocations› Each method is completely independent› Client passes needed information as parameters to the method› Participate in instance poolinginstance pooling› Greatest scalability› Many clients share limited number of instances

Implements javax.ejb.SessionBean

Page 18: Point Of Sale(POS) J2EE Application

Home / Remote Interface

Home Interface› Defines methods to create (obtain), find, or remove

a Bean Instance on behalf of the client› Extends javax.ejb.EJBHome

Remote Interface› Defines the bean's business methods› Extends javax.ejb.EJBObject

Page 19: Point Of Sale(POS) J2EE Application

Packaging the Bean in a JAR File

ShoppingListHome.classShoppingListHome.class

ShoppingList.classShoppingList.class

ShoppingListEJB.classShoppingListEJB.class

ejb.xmlejb.xml

Includes:› Bean class› Remote interface› Home Interface› Deployment descriptor

(ejb.xml)

Page 20: Point Of Sale(POS) J2EE Application

Deploy Tool

Deploy Tool(Macromedia KAWA, J2EE deploytool) generates stub classes and object classes

Deploy Tool uses jar file and generates necessary classes for EJB server

Stub classes › Downloaded to a client dynamically at run time› Used by client

Object classes› Implement all corresponding interfaces› Used by EJB server

Page 21: Point Of Sale(POS) J2EE Application

EJB Conceptual Architecture

EJB Server

EJB ClassEJB Object Stub

Remote Interface

JNDI Server

InitialContext

lookup(“Customer")

EJB Home Stub

Home Interface

EJB Object

Remote Interface

EJB Home

Home Interface

create/find

getList( )

‚ƒ

‡ ˆ

Page 22: Point Of Sale(POS) J2EE Application

Development Process EJB

CustomerHome.classCustomerHome.class

Customer.classCustomer.class

CustomerEJB.classCustomerEJB.class

ejb.xmlejb.xml

EJB Devloper

Developer› Home Interface› Remote Interface› EJB class› Support classes

Deployer (Deploy tool)› Packaging Interfaces, EJB class, and support classes› Deploy the packaged EJB (jar file)

Server› Implement EJB

EJB Servers

Page 23: Point Of Sale(POS) J2EE Application

POS Component Example

Add, remove, and display a customer shopping list

Index.jsp

ShoppingListSession

Add Remove

Display

Display all shopping list

from EJB

Form action to add / remove shopping list

Capture the Shopping list id

Call bean method to be fit with each action

Implement get, add, remove shipping list

methods

AddShoppingListRemoveShoppingList

DB

ShoppingCartTable

Select, update, delete shopping

list from ShoppingCart

table

Page 24: Point Of Sale(POS) J2EE Application

POS Security Mechanism

Form Based JRun application security based on J2EE User / Group / Role Protect entire application JSPs / Servlets / EJBs *) DatabaseAthentication.java to verify user using DB

Login.jspLogin.jspHTMLJSP

ServletEJB

Other Resources

HTMLJSP

ServletEJB

Other Resources

Authentication*Servlet

Authentication*Servlet

Loginerror.jspLoginerror.jsp

POS

Page 25: Point Of Sale(POS) J2EE Application

POS Scheduler

Jrun provides a Scheduler servlet to execute actions at specified times

Scheduler servlet : allaire.jrun.scheduler.CronService Defines the servlet in web.xml Application defines Schedule.ini for the service Schedule.ini includes the rule and the requests to be

scheduled * If this service is used in application, this application

is not potable because JRun added this service.

Page 26: Point Of Sale(POS) J2EE Application

Web.xml sample for scheduler

<servlet> defines the service </servlet><servlet> <servlet-name>POSScheduler</servlet-name>

<servlet-class>allaire.jrun.scheduler.CronService</servlet-class><display-name>POSScheduler</display-name><description>Scheduler for POS System</description><init-param>

<param-name>schedfile</param-name><param-value>C:\JRun\3.0\servers\default\pos-app\schedule.ini</param-value>

</init-param><init-param>

<param-name>logfile</param-name><param-value>C:\JRun\3.0\servers\default\pos-app\scheduler-log\pos-scheduler.log</param-value>

</init-param><load-on-startup/>

</servlet>

Except those bold tags, developer can give any name or file

Page 27: Point Of Sale(POS) J2EE Application

Schedule.ini Example

Schedule.ini is defined in web.xml<init-param>

<param-name>schedfile</param-name><param-value>C:\JRun\3.0\servers\default\pos-app\schedule.ini</param-value>

</init-param>

Developer can use any file name on that Schedule.ini example# This is the ini file for JRun scheduler# Scheduler checks the shopping cart table every ten minutes and updates the shopping cart status.# If the shopping cart items are found to be older than 2hr, those will be deleted.# Those items to be older than 2hr are supposed to be not in the cart or customer left the store without checkout.

0 0,10,20,30,40,50 * * * * http://localhost/pos/servlet/SchedulerForShoppingCart

Scheduler runs this servlet every ten minutes

Page 28: Point Of Sale(POS) J2EE Application

Supplementary Issues

Physical Security Mechanism Barcode scanner integration(physical) Credit card process integration(physical) Business data exchange using XML