01: /*
02: * Generated file - Do not edit!
03: */
04: package org.jboss.test.cmp2.cmrtree.ejb;
05:
06: /**
07: * Utility class for Facade.
08: */
09: public class FacadeUtil {
10: /** Cached remote home (EJBHome). Uses lazy loading to obtain its value (loaded by getHome() methods). */
11: private static FacadeHome cachedRemoteHome = null;
12:
13: // Home interface lookup methods
14:
15: /**
16: * Obtain remote home interface from default initial context
17: * @return Home interface for Facade. Lookup using JNDI_NAME
18: */
19: public static FacadeHome getHome()
20: throws javax.naming.NamingException {
21: if (cachedRemoteHome == null) {
22: // Obtain initial context
23: javax.naming.InitialContext initialContext = new javax.naming.InitialContext();
24: try {
25: Object objRef = initialContext
26: .lookup(FacadeHome.JNDI_NAME);
27: cachedRemoteHome = (FacadeHome) javax.rmi.PortableRemoteObject
28: .narrow(
29: objRef,
30: org.jboss.test.cmp2.cmrtree.ejb.FacadeHome.class);
31: } finally {
32: initialContext.close();
33: }
34: }
35: return cachedRemoteHome;
36: }
37:
38: /**
39: * Obtain remote home interface from parameterised initial context
40: * @param environment Parameters to use for creating initial context
41: * @return Home interface for Facade. Lookup using JNDI_NAME
42: */
43: public static FacadeHome getHome(java.util.Hashtable environment)
44: throws javax.naming.NamingException {
45: // Obtain initial context
46: javax.naming.InitialContext initialContext = new javax.naming.InitialContext(
47: environment);
48: try {
49: Object objRef = initialContext.lookup(FacadeHome.JNDI_NAME);
50: return (FacadeHome) javax.rmi.PortableRemoteObject.narrow(
51: objRef, FacadeHome.class);
52: } finally {
53: initialContext.close();
54: }
55: }
56:
57: }
|