01: /*
02: * Copyright (c) 2002-2003 by OpenSymphony
03: * All rights reserved.
04: */
05: /*
06: * Generated file - Do not edit!
07: */
08: package com.opensymphony.workflow.spi.ejb;
09:
10: /**
11: * Utility class for CurrentStepPrev.
12: * @author Hani Suleiman (hani@formicary.net) Date: Apr 7, 2003 Time: 8:17:26 PM
13: */
14: public class CurrentStepPrevHomeFactory {
15: //~ Static fields/initializers /////////////////////////////////////////////
16:
17: public static final String COMP_NAME = "java:comp/env/ejb/CurrentStepPrev";
18: public static final String JNDI_NAME = "CurrentStepPrev";
19:
20: /** Cached local home (EJBLocalHome). Uses lazy loading to obtain its value (loaded by getLocalHome() methods). */
21: private static com.opensymphony.workflow.spi.ejb.CurrentStepPrevLocalHome cachedLocalHome = null;
22:
23: //~ Methods ////////////////////////////////////////////////////////////////
24:
25: // Home interface lookup methods
26:
27: /**
28: * Obtain local home interface from default initial context
29: * @return Local home interface for CurrentStepPrev. Lookup using COMP_NAME
30: */
31: public static com.opensymphony.workflow.spi.ejb.CurrentStepPrevLocalHome getLocalHome()
32: throws javax.naming.NamingException {
33: if (cachedLocalHome == null) {
34: cachedLocalHome = (com.opensymphony.workflow.spi.ejb.CurrentStepPrevLocalHome) lookupHome(
35: null,
36: COMP_NAME,
37: com.opensymphony.workflow.spi.ejb.CurrentStepPrevLocalHome.class);
38: }
39:
40: return cachedLocalHome;
41: }
42:
43: private static Object lookupHome(java.util.Hashtable environment,
44: String jndiName, Class narrowTo)
45: throws javax.naming.NamingException {
46: // Obtain initial context
47: javax.naming.InitialContext initialContext = new javax.naming.InitialContext(
48: environment);
49:
50: try {
51: Object objRef = initialContext.lookup(jndiName);
52:
53: // only narrow if necessary
54: if (java.rmi.Remote.class.isAssignableFrom(narrowTo)) {
55: return javax.rmi.PortableRemoteObject.narrow(objRef,
56: narrowTo);
57: } else {
58: return objRef;
59: }
60: } finally {
61: initialContext.close();
62: }
63: }
64: }
|