KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Id: Bank.java 3982 2006-11-22 14:28:01Z lajos $
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;
12
13 import java.io.Serializable JavaDoc;
14
15 import org.apache.commons.logging.Log;
16 import org.apache.commons.logging.LogFactory;
17 import org.mule.impl.UMODescriptorAware;
18 import org.mule.samples.loanbroker.service.BankService;
19 import org.mule.umo.UMODescriptor;
20
21 /**
22  * <code>Bank</code> is a representation of a bank from which to obtain loan
23  * quotes.
24  */

25
26 public class Bank implements BankService, UMODescriptorAware, Serializable JavaDoc
27 {
28     /**
29      * Serial version
30      */

31     private static final long serialVersionUID = 2576893239001689631L;
32
33     /**
34      * logger used by this class
35      */

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