ECE 493-T5 Project Tutorial 2 Tiuley Alguindigueltahvild/courses/... · Project Tutorial 2 Tiuley...

16
The Duke’s Bank Application ECE 493-T5 Project Tutorial 2 Tiuley Alguindigue

Transcript of ECE 493-T5 Project Tutorial 2 Tiuley Alguindigueltahvild/courses/... · Project Tutorial 2 Tiuley...

Page 1: ECE 493-T5 Project Tutorial 2 Tiuley Alguindigueltahvild/courses/... · Project Tutorial 2 Tiuley Alguindigue. Summary Slide • The Duke’s Bank Application • Enterprise Beans

The Duke’s Bank Application

ECE 493-T5Project Tutorial 2

Tiuley Alguindigue

Page 2: ECE 493-T5 Project Tutorial 2 Tiuley Alguindigueltahvild/courses/... · Project Tutorial 2 Tiuley Alguindigue. Summary Slide • The Duke’s Bank Application • Enterprise Beans

Summary Slide• The Duke’s Bank Application• Enterprise Beans• Session Beans• Entity Beans Remote/Local Interfaces

in Bank Application• Database Tables• User Roles• Client Components• Web Client• Run the application

Page 3: ECE 493-T5 Project Tutorial 2 Tiuley Alguindigueltahvild/courses/... · Project Tutorial 2 Tiuley Alguindigue. Summary Slide • The Duke’s Bank Application • Enterprise Beans

Duke's Bank Application(from J2EE 1.4 Tutorial)

• Online banking application.

• Duke's Bank has two clients:

– an application client used by administrators to manage customers and accounts,

– a web client used by customers to access account histories and perform transactions.

• The clients access the customer, account, and transaction information maintained in a database through enterprise beans.

• The Duke's Bank application demonstrates the J2EE 1.4 component technologies -enterprise beans, application clients, and web components—in simple but functional application.

Page 4: ECE 493-T5 Project Tutorial 2 Tiuley Alguindigueltahvild/courses/... · Project Tutorial 2 Tiuley Alguindigue. Summary Slide • The Duke’s Bank Application • Enterprise Beans

Duke's Bank Application

Page 5: ECE 493-T5 Project Tutorial 2 Tiuley Alguindigueltahvild/courses/... · Project Tutorial 2 Tiuley Alguindigue. Summary Slide • The Duke’s Bank Application • Enterprise Beans

Enterprise Beans

Page 6: ECE 493-T5 Project Tutorial 2 Tiuley Alguindigueltahvild/courses/... · Project Tutorial 2 Tiuley Alguindigue. Summary Slide • The Duke’s Bank Application • Enterprise Beans

Session Beans

• The Duke's Bank application has three session beans:

– AccountControllerBean– CustomerControllerBean– TxControllerBean (Tx = transaction )

• Provide a client's view of the application's business logic

Page 7: ECE 493-T5 Project Tutorial 2 Tiuley Alguindigueltahvild/courses/... · Project Tutorial 2 Tiuley Alguindigue. Summary Slide • The Duke’s Bank Application • Enterprise Beans

AccountControllerBeanSession Bean

• Business methods perform tasks that fall into the following categories:– creating and removing entity beans

• createAccount• removeAccount

– managing the account-customer relationship• addCustomerToAccount• removeCustomerFromAccount

– getting the account information.• getAccountsOfCustomer• getDetails ( saves multiple remote calls)

Page 8: ECE 493-T5 Project Tutorial 2 Tiuley Alguindigueltahvild/courses/... · Project Tutorial 2 Tiuley Alguindigue. Summary Slide • The Duke’s Bank Application • Enterprise Beans

AccountControllerBean

• Use bean managed persistance to manage the many-to-many relationship between the AccountBean and the CustomerBean

Page 9: ECE 493-T5 Project Tutorial 2 Tiuley Alguindigueltahvild/courses/... · Project Tutorial 2 Tiuley Alguindigue. Summary Slide • The Duke’s Bank Application • Enterprise Beans

TxControllerBeanSession Bean

• TxControllerBean session bean handles bank transactions:• getTxsOfAccount• getDetails• withdraw• deposit• makeCharge• makePayment• transferFunds – has a Required Transaction Attribute

Page 10: ECE 493-T5 Project Tutorial 2 Tiuley Alguindigueltahvild/courses/... · Project Tutorial 2 Tiuley Alguindigue. Summary Slide • The Duke’s Bank Application • Enterprise Beans

Entity Beans • Represent the tree business entity represented in the bank

application:

• AccountBean• CustomerBean• TxBean

• They provide an object view of the database tables: account, customer, and tx.

• Use container-managed persistence (no SQL statements that access the tables)

• Helper entity bean, NextIdBean, is used to create account, customer, and transaction IDs.

Page 11: ECE 493-T5 Project Tutorial 2 Tiuley Alguindigueltahvild/courses/... · Project Tutorial 2 Tiuley Alguindigue. Summary Slide • The Duke’s Bank Application • Enterprise Beans

Entity Beans • The entity beans do not validate method

parameters

• Session beans do the method validations.Ie, check the parameters and throw the application

exceptions such as CustomerNotInAccountException

• Because the entity beans always run in the same Java VM as their clients the session beans, for improved performance the entity beans are coded with local interfaces.

Page 12: ECE 493-T5 Project Tutorial 2 Tiuley Alguindigueltahvild/courses/... · Project Tutorial 2 Tiuley Alguindigue. Summary Slide • The Duke’s Bank Application • Enterprise Beans

Remote/Local Interfaces in Bank Application

Session beans are defined with remote interfacesto allow for remote clients.

Entity beans are defined with local interfaces. Its clients, are the session beans and are in the same JVM.

Sesion beans are local clients to the enterprise beans – so they reference their local interfaces.

Page 13: ECE 493-T5 Project Tutorial 2 Tiuley Alguindigueltahvild/courses/... · Project Tutorial 2 Tiuley Alguindigue. Summary Slide • The Duke’s Bank Application • Enterprise Beans

Database Tables

Page 14: ECE 493-T5 Project Tutorial 2 Tiuley Alguindigueltahvild/courses/... · Project Tutorial 2 Tiuley Alguindigue. Summary Slide • The Duke’s Bank Application • Enterprise Beans

User Roles• Define using the Admin Console:

• bankCustomer - administrative functions • bankAdmin – user

• Method permissions on selected methods of the CustomerControllerBean, AccountControllerBean, and TxControllerBeanenterprise beans are defined at deployment time.

Page 15: ECE 493-T5 Project Tutorial 2 Tiuley Alguindigueltahvild/courses/... · Project Tutorial 2 Tiuley Alguindigue. Summary Slide • The Duke’s Bank Application • Enterprise Beans

Web ClientComponents

• All the JavaBeans components used in the web client are instantiated by Dispatcher.

• The BeanManager and CustomerBeancomponents are instantiated for the session and request, respectively. The other beans--AccountHistoryBean, TransferBean, and ATMBean--are instantiated depending on which request URL is being handled.

Page 16: ECE 493-T5 Project Tutorial 2 Tiuley Alguindigueltahvild/courses/... · Project Tutorial 2 Tiuley Alguindigue. Summary Slide • The Duke’s Bank Application • Enterprise Beans

Web Client

List the history of an account

http://localhost:8080/bank/accountHist