package itso.bank.facade;
import itso.bank.model.ejb.Account;
import itso.bank.model.ejb.Customer;
import itso.bank.model.ejb.Transaction;
/**
* The facade for the ITSO bank.
*
* The class is a singleton, controlled through the static method <code>getBank</code>.
*
* The class is used as follows (this example retrieves an Account object
* for a given account number):
*
* <pre>
* Bank bank = Bank.getBank();
* Account account = bank.getAccount(accountNumber);
* </pre>
*
* @see Bank#getBank()
*/
public abstract class Bank
{
/**
* The Bank singleton
*/
private static Bank singleton = null;
/**
* Create a singleton. The method will ensure that only
* one Bank object is created.
*
* @throws ApplicationException If an application-level non-business related
* exception occurred.
*
* @see Bank#Bank()
*/
public static Bank getBank() throws Exception {
if (singleton == null) {
// no singleton has been created yet - create one
//singleton = new MemoryBank();
singleton = new EJBBank();
}
return singleton;
}
/**
* Retrieve a Customer object for a given customer number (SSN).
*
* @param customerNumber The customer number (SSN) to look up.
* @return A Customer instance, representing that customer.
* @throws UnknownCustomerException If the specified customer
* does not exist.
* @throws ApplicationException If an application-level non-business related
* exception occurred.
*
* @see Customer
*/
public abstract Customer getCustomer(String customerNumber)
throws Exception;
/**
* Retrieve an array of the accounts for a given customer
* number (SSN).
*
* @param customerNumber The customer number (SSN) to look up.
* @return An array of Account instances, each representing an
* account that the customer owns within the bank.
* @throws UnknownCustomerException If the specified customer
* does not exist.
* @throws ApplicationException If an application-level non-business related
* exception occurred.
*
* @see Account
*/
public abstract Account[] getAccounts(String customerNumber)
throws Exception;
/**
* Retrieve an Account object for a given account number.
*
* @param accountNumber The account number to look up.
* @return An Account instance, representing the given
* account number.
* @throws UnknownAccountException If the account does not
* exist.
* @throws ApplicationException If an application-level non-business related
* exception occurred.
*
* @see Account
*/
public abstract Account getAccount(String accountNumber)
throws Exception;
/**
* Retrieve an array of transaction records for the given account.
*
* @param accountId The account number to retrieve the transaction
* log for.
* @return An array of instances of the Transaction class, each
* representing a movement on the account. If the account has
* had no transaction, an empty array (an array of length zero)
* is returned.
* @throws UnknownAccountException If the specified account does not exist.
* @throws ApplicationException If an application-level non-business related
* exception occurred.
*
* @see Transaction
*/
public abstract Transaction[] getTransactions(String accountId)
throws Exception;
/**
* Update the customer data for the specified customer. The specified SSN
* must match an existing customer.
*
* @param ssn
* @param title
* @param firstName
* @param lastName
* @throws UnknownCustomerException If either of the accounts do not exist.
* @throws ApplicationException If an application-level non-business related
* exception occurred.
*/
public abstract void updateCustomer(String ssn, String title, String firstName, String lastName)
throws Exception;
/**
* Deposit (credit) the specified amount of cents to
* the specified account.
*
* After a successful transaction, the transaction log for
* the account will be updated.
*
* @param accountId The account number to deposit into.
* @param amount The amount to deposit, in cents.
* @throws UnknownAccountException If the account does not exist.
* @throws ApplicationException If an application-level non-business related
* exception occurred.
*/
public abstract void deposit(String accountId, int amount)
throws Exception;
/**
* Withdraw (debit) the specified amount of cents from
* the specified account.
*
* After a successful transaction, the transaction log for
* the account will be updated.
*
* @param accountId The account number to withdraw from.
* @param amount The amount to withdraw, in cents.
* @throws UnknownAccountException If the account does not exist.
* @throws InsufficientFundsException If the amount exceeds the
* current balance of the account.
* @throws ApplicationException If an application-level non-business related
* exception occurred.
*/
public abstract void withdraw(String accountId, int amount)
throws Exception;
/**
* Transfer the specified amount of cents from one account to
* another. The accounts do not need to be owned by the same customer.
*
* After a successful transaction, the transaction log for
* both accounts will be updated.
*
* @param debitAccountNumber The account number to withdraw (debit) from.
* @param creditAccountNumber The account number to deposit (credit) to.
* @param amount The amount to transfer, in cents.
* @throws UnknownAccountException If either of the accounts do not exist.
* @throws InsufficientFundsException If the amount exceeds the
* current balance of the debit account.
* @throws ApplicationException If an application-level non-business related
* exception occurred.
*/
public abstract void transfer(String debitAccountNumber, String creditAccountNumber, int amount)
throws Exception;
}
没有合适的资源?快使用搜索试试~ 我知道了~
RSA7.5 下一个EJB3例子,WAS 7.0 + ORACLE10g
共112个文件
java:24个
class:24个
xml:12个
需积分: 10 27 下载量 132 浏览量
2008-11-20
13:06:39
上传
评论
收藏 628KB RAR 举报
温馨提示
一个EJB3的例子,原来的例子是Jarek Miszczyk 所作, 他用的是DB2数据库,这台机器上没安,所以就改造一下用在Oracle10g上了,有多对多关系映射,EJB3比hibernate好,我的感觉,而且是正宗名门。 压缩包有三个工程文件,导入RSA7.5中就可以了,别忘了先建数据库再在RSA建数据库连接。 压缩包中我打入了几个脚本,可以直接生成table space,user,数据库和table. 请参考压缩包中的Word文档。 这个例子是RSA 7.5刚发布不久时为了试用RSA7.5所作的,今天有空发上来,RSA7.5是我用过最大的软件了,竟然快8G了,不过是个好软件。
资源推荐
资源详情
资源评论
收起资源包目录
RSA7.5 下一个EJB3例子,WAS 7.0 + ORACLE10g (112个子文件)
BankFacade.class 6KB
TransactionsManager.class 6KB
CreditManager.class 5KB
DebitManager.class 5KB
CustomerManager.class 5KB
AccountManager.class 5KB
EJBBank.class 4KB
Account.class 3KB
PerformTransaction.class 3KB
Transaction.class 3KB
ListAccounts.class 3KB
UpdateCustomer.class 3KB
Customer.class 3KB
AccountDetails.class 2KB
TransferCommand.class 2KB
Logout.class 2KB
WithdrawCommand.class 1KB
DepositCommand.class 1KB
ListTransactionsCommand.class 1KB
Bank.class 1KB
Debit.class 1KB
Credit.class 1KB
BankFacadeRemote.class 846B
Command.class 312B
.classpath 883B
.classpath 801B
org.eclipse.wst.common.component 722B
org.eclipse.wst.common.component 544B
org.eclipse.wst.common.component 373B
org.eclipse.wst.jsdt.ui.superType.container 49B
gray.css 9KB
Master.css 731B
Taming EJB 3 Development with Rational Application Developer 7.docx 453KB
.factorypath 489B
.factorypath 489B
logo_gray.gif 3KB
itso_logo.gif 2KB
c.gif 43B
WebDiagram.gph 1KB
rates.html 3KB
redbank.html 3KB
insurance.html 2KB
nav_head.html 1KB
footer.html 1KB
itso_html_template.htpl 2KB
sitelib.jar 29KB
Bank.java 6KB
TransactionsManager.java 5KB
BankFacade.java 5KB
CreditManager.java 5KB
DebitManager.java 4KB
CustomerManager.java 4KB
PerformTransaction.java 4KB
ListAccounts.java 4KB
AccountManager.java 4KB
UpdateCustomer.java 3KB
EJBBank.java 3KB
AccountDetails.java 3KB
Transaction.java 3KB
Logout.java 3KB
Account.java 2KB
Customer.java 2KB
TransferCommand.java 2KB
ListTransactionsCommand.java 1KB
WithdrawCommand.java 1KB
DepositCommand.java 1KB
Command.java 1KB
Credit.java 968B
Debit.java 883B
BankFacadeRemote.java 883B
jsfejb3.jpg 59KB
.jsdtscope 454B
listAccounts.jsp 4KB
accountDetails.jsp 4KB
listTransactions.jsp 3KB
index.jsp 3KB
default.jsp 3KB
showException.jsp 3KB
nav_head.jsp 1KB
footer.jsp 1KB
itso_jsp_template.jtpl 2KB
MANIFEST.MF 51B
MANIFEST.MF 39B
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.jdt.core.prefs 687B
org.eclipse.jdt.core.prefs 388B
org.eclipse.jst.common.project.facet.core.prefs 385B
org.eclipse.jst.common.project.facet.core.prefs 385B
org.eclipse.jdt.apt.core.prefs 194B
org.eclipse.jdt.apt.core.prefs 194B
org.eclipse.jpt.core.prefs 164B
.project 1KB
.project 997B
.project 689B
ITSOBANK.rar 28KB
my ejb topic diagram.tpx 1KB
.wdo-connections 718B
.websettings 171B
ibm-web-ext.xmi 638B
ibm-web-bnd.xmi 294B
共 112 条
- 1
- 2
资源评论
hanit
- 粉丝: 10
- 资源: 16
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功