KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > samples > loanbroker > esb > bank > Bank


1 /*
2  * $Id: Bank.java 3798 2006-11-04 04:07:14Z aperepel $
3  * --------------------------------------------------------------------------------------
4  * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
5  *
6  * The software in this package is published under the terms of the MuleSource MPL
7  * license, a copy of which has been included with this distribution in the
8  * LICENSE.txt file.
9  */

10
11 package org.mule.samples.loanbroker.esb.bank;
12
13 import org.apache.commons.logging.Log;
14 import org.apache.commons.logging.LogFactory;
15 import org.mule.impl.UMODescriptorAware;
16 import org.mule.samples.loanbroker.esb.message.LoanQuote;
17 import org.mule.samples.loanbroker.esb.message.LoanQuoteRequest;
18 import org.mule.umo.UMODescriptor;
19
20 import java.io.Serializable JavaDoc;
21
22 /**
23  * <code>Bank</code> is a representation of a bank form which to obtain loan
24  * quotes.
25  *
26  * @author Gregor Hohpe, Bobby Wolfe, et al. EI Patterns
27  * @author <a HREF="mailto:ross.mason@symphonysoft.com">Ross Mason</a>
28  * @version $Revision: 3798 $
29  */

30
31 public class Bank implements UMODescriptorAware, Serializable JavaDoc, BankService
32 {
33     /**
34      * Serial version
35      */

36     private static final long serialVersionUID = 4108271137166107769L;
37
38     /**
39      * logger used by this class
40      */

41     protected static transient Log logger = LogFactory.getLog(Bank.class);
42
43     private String JavaDoc bankName;
44     private String JavaDoc endpoint = "";
45     private double primeRate;
46
47     public Bank()
48     {
49         this.primeRate = Math.random() * 10;
50     }
51
52     public Bank(String JavaDoc bankname, String JavaDoc endpoint)
53     {
54         this();
55         this.bankName = bankname;
56         this.endpoint = endpoint;
57     }
58
59     public void setDescriptor(UMODescriptor descriptor)
60     {
61         this.bankName = descriptor.getName();
62     }
63
64     public LoanQuote getLoanQuote(LoanQuoteRequest request)
65     {
66         LoanQuote quote = new LoanQuote();
67         quote.setBankName(getBankName());
68         quote.setInterestRate(primeRate);
69         logger.info("Returning Rate is:" + quote);
70         return quote;
71     }
72
73     public String JavaDoc getBankName()
74     {
75         return bankName;
76     }
77
78     public void setBankName(String JavaDoc bankName)
79     {
80         this.bankName = bankName;
81     }
82
83     public String JavaDoc getEndpoint()
84     {
85         return endpoint;
86     }
87
88     public void setEndpoint(String JavaDoc endpoint)
89     {
90         this.endpoint = endpoint;
91     }
92
93     public double getPrimeRate()
94     {
95         return primeRate;
96     }
97
98     public void setPrimeRate(double primeRate)
99     {
100         this.primeRate = primeRate;
101     }
102
103 }
104
Popular Tags