KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > cmp2 > cmrstress > interfaces > ParentUtil


1 /*
2  * Generated file - Do not edit!
3  */

4 package org.jboss.test.cmp2.cmrstress.interfaces;
5
6 /**
7  * Utility class for Parent.
8  */

9 public class ParentUtil
10 {
11    /** Cached remote home (EJBHome). Uses lazy loading to obtain its value (loaded by getHome() methods). */
12    private static org.jboss.test.cmp2.cmrstress.interfaces.ParentHome cachedRemoteHome = null;
13
14    /** Cached local home (EJBLocalHome). Uses lazy loading to obtain its value (loaded by getLocalHome() methods). */
15    private static org.jboss.test.cmp2.cmrstress.interfaces.ParentLocalHome cachedLocalHome = null;
16
17    // Home interface lookup methods
18

19    /**
20     * Obtain remote home interface from default initial context
21     * @return Home interface for Parent. Lookup using JNDI_NAME
22     */

23    public static org.jboss.test.cmp2.cmrstress.interfaces.ParentHome getHome() throws javax.naming.NamingException JavaDoc
24    {
25       if (cachedRemoteHome == null) {
26          // Obtain initial context
27
javax.naming.InitialContext JavaDoc initialContext = new javax.naming.InitialContext JavaDoc();
28          try {
29             java.lang.Object JavaDoc objRef = initialContext.lookup(org.jboss.test.cmp2.cmrstress.interfaces.ParentHome.JNDI_NAME);
30             cachedRemoteHome = (org.jboss.test.cmp2.cmrstress.interfaces.ParentHome) javax.rmi.PortableRemoteObject.narrow(objRef, org.jboss.test.cmp2.cmrstress.interfaces.ParentHome.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 Parent. Lookup using JNDI_NAME
42     */

43    public static org.jboss.test.cmp2.cmrstress.interfaces.ParentHome getHome( java.util.Hashtable JavaDoc environment ) throws javax.naming.NamingException JavaDoc
44    {
45       // Obtain initial context
46
javax.naming.InitialContext JavaDoc initialContext = new javax.naming.InitialContext JavaDoc(environment);
47       try {
48          java.lang.Object JavaDoc objRef = initialContext.lookup(org.jboss.test.cmp2.cmrstress.interfaces.ParentHome.JNDI_NAME);
49          return (org.jboss.test.cmp2.cmrstress.interfaces.ParentHome) javax.rmi.PortableRemoteObject.narrow(objRef, org.jboss.test.cmp2.cmrstress.interfaces.ParentHome.class);
50       } finally {
51          initialContext.close();
52       }
53    }
54
55    /**
56     * Obtain local home interface from default initial context
57     * @return Local home interface for Parent. Lookup using JNDI_NAME
58     */

59    public static org.jboss.test.cmp2.cmrstress.interfaces.ParentLocalHome getLocalHome() throws javax.naming.NamingException JavaDoc
60    {
61       // Local homes shouldn't be narrowed, as there is no RMI involved.
62
if (cachedLocalHome == null) {
63          // Obtain initial context
64
javax.naming.InitialContext JavaDoc initialContext = new javax.naming.InitialContext JavaDoc();
65          try {
66             cachedLocalHome = (org.jboss.test.cmp2.cmrstress.interfaces.ParentLocalHome) initialContext.lookup(org.jboss.test.cmp2.cmrstress.interfaces.ParentLocalHome.JNDI_NAME);
67          } finally {
68             initialContext.close();
69          }
70       }
71       return cachedLocalHome;
72    }
73
74 }
Popular Tags