KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > ebank > util > EJBGetter


1 /*
2  * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. U.S.
3  * Government Rights - Commercial software. Government users are subject
4  * to the Sun Microsystems, Inc. standard license agreement and
5  * applicable provisions of the FAR and its supplements. Use is subject
6  * to license terms.
7  *
8  * This distribution may include materials developed by third parties.
9  * Sun, Sun Microsystems, the Sun logo, Java and J2EE are trademarks
10  * or registered trademarks of Sun Microsystems, Inc. in the U.S. and
11  * other countries.
12  *
13  * Copyright (c) 2004 Sun Microsystems, Inc. Tous droits reserves.
14  *
15  * Droits du gouvernement americain, utilisateurs gouvernementaux - logiciel
16  * commercial. Les utilisateurs gouvernementaux sont soumis au contrat de
17  * licence standard de Sun Microsystems, Inc., ainsi qu'aux dispositions
18  * en vigueur de la FAR (Federal Acquisition Regulations) et des
19  * supplements a celles-ci. Distribue par des licences qui en
20  * restreignent l'utilisation.
21  *
22  * Cette distribution peut comprendre des composants developpes par des
23  * tierces parties. Sun, Sun Microsystems, le logo Sun, Java et J2EE
24  * sont des marques de fabrique ou des marques deposees de Sun
25  * Microsystems, Inc. aux Etats-Unis et dans d'autres pays.
26  */

27
28
29 package com.sun.ebank.util;
30
31 import javax.rmi.PortableRemoteObject JavaDoc;
32 import javax.naming.InitialContext JavaDoc;
33 import javax.naming.NamingException JavaDoc;
34 import com.sun.ebank.ejb.account.AccountHome;
35 import com.sun.ebank.ejb.account.AccountControllerHome;
36 import com.sun.ebank.ejb.customer.CustomerHome;
37 import com.sun.ebank.ejb.customer.CustomerControllerHome;
38 import com.sun.ebank.ejb.tx.TxHome;
39 import com.sun.ebank.ejb.tx.TxControllerHome;
40 import com.sun.ebank.ejb.exception.*;
41
42
43 /**
44  * This helper class fetches EJB home references.
45  */

46 public final class EJBGetter {
47     public static AccountHome getAccountHome() throws NamingException JavaDoc {
48         InitialContext JavaDoc initial = new InitialContext JavaDoc();
49         Object JavaDoc objref = initial.lookup(CodedNames.ACCOUNT_EJBHOME);
50
51         return (AccountHome) PortableRemoteObject.narrow(objref,
52             AccountHome.class);
53     }
54
55     public static AccountControllerHome getAccountControllerHome()
56         throws NamingException JavaDoc {
57         InitialContext JavaDoc initial = new InitialContext JavaDoc();
58         Object JavaDoc objref = initial.lookup(CodedNames.ACCOUNT_CONTROLLER_EJBHOME);
59
60         return (AccountControllerHome) PortableRemoteObject.narrow(objref,
61             AccountControllerHome.class);
62     }
63
64     public static CustomerHome getCustomerHome() throws NamingException JavaDoc {
65         InitialContext JavaDoc initial = new InitialContext JavaDoc();
66         Object JavaDoc objref = initial.lookup(CodedNames.CUSTOMER_EJBHOME);
67
68         return (CustomerHome) PortableRemoteObject.narrow(objref,
69             CustomerHome.class);
70     }
71
72     public static CustomerControllerHome getCustomerControllerHome()
73         throws NamingException JavaDoc {
74         InitialContext JavaDoc initial = new InitialContext JavaDoc();
75         Object JavaDoc objref = initial.lookup(CodedNames.CUSTOMER_CONTROLLER_EJBHOME);
76
77         return (CustomerControllerHome) PortableRemoteObject.narrow(objref,
78             CustomerControllerHome.class);
79     }
80
81     public static TxHome getTxHome() throws NamingException JavaDoc {
82         InitialContext JavaDoc initial = new InitialContext JavaDoc();
83         Object JavaDoc objref = initial.lookup(CodedNames.TX_EJBHOME);
84
85         return (TxHome) PortableRemoteObject.narrow(objref, TxHome.class);
86     }
87
88     public static TxControllerHome getTxControllerHome()
89         throws NamingException JavaDoc {
90         InitialContext JavaDoc initial = new InitialContext JavaDoc();
91         Object JavaDoc objref = initial.lookup(CodedNames.TX_CONTROLLER_EJBHOME);
92
93         return (TxControllerHome) PortableRemoteObject.narrow(objref,
94             TxControllerHome.class);
95     }
96 }
97  // EJBGetter
98
Popular Tags