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

Post on 27-Sep-2020

0 views 0 download

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

The Duke’s Bank Application

ECE 493-T5Project Tutorial 2

Tiuley Alguindigue

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

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.

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

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)

AccountControllerBean

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

TxControllerBeanSession Bean

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

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.

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.

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.

Database Tables

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.

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.

Web Client

List the history of an account

http://localhost:8080/bank/accountHist