KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > workflow > spi > ejb > WorkflowStoreHomeFactory


1 /*
2  * Copyright (c) 2002-2003 by OpenSymphony
3  * All rights reserved.
4  */

5 /*
6  * Generated file - Do not edit!
7  */

8 package com.opensymphony.workflow.spi.ejb;
9
10
11 /**
12  * Utility class for WorkflowStore.
13  * @author <a HREF="mailto:hani@formicary.net">Hani Suleiman</a>
14  * @version $Revision: 1.3 $ Date: Apr 7, 2003 Time: 10:57:28 PM
15  */

16 public class WorkflowStoreHomeFactory {
17     //~ Static fields/initializers /////////////////////////////////////////////
18

19     public static final String JavaDoc COMP_NAME = "java:comp/env/ejb/WorkflowStore";
20     public static final String JavaDoc JNDI_NAME = "WorkflowStore";
21
22     /** Cached remote home (EJBHome). Uses lazy loading to obtain its value (loaded by getHome() methods). */
23     private static com.opensymphony.workflow.spi.ejb.WorkflowStoreHome cachedRemoteHome = null;
24
25     //~ Methods ////////////////////////////////////////////////////////////////
26

27     // Home interface lookup methods
28

29     /**
30      * Obtain remote home interface from default initial context
31      * @return Home interface for WorkflowStore. Lookup using COMP_NAME
32      */

33     public static com.opensymphony.workflow.spi.ejb.WorkflowStoreHome getHome() throws javax.naming.NamingException JavaDoc {
34         if (cachedRemoteHome == null) {
35             // Obtain initial context
36
javax.naming.InitialContext JavaDoc initialContext = new javax.naming.InitialContext JavaDoc();
37
38             try {
39                 java.lang.Object JavaDoc objRef = initialContext.lookup(COMP_NAME);
40                 cachedRemoteHome = (com.opensymphony.workflow.spi.ejb.WorkflowStoreHome) javax.rmi.PortableRemoteObject.narrow(objRef, com.opensymphony.workflow.spi.ejb.WorkflowStoreHome.class);
41             } finally {
42                 initialContext.close();
43             }
44         }
45
46         return cachedRemoteHome;
47     }
48
49     /**
50      * Obtain remote home interface from parameterised initial context
51      * @param environment Parameters to use for creating initial context
52      * @return Home interface for WorkflowStore. Lookup using COMP_NAME
53      */

54     public static com.opensymphony.workflow.spi.ejb.WorkflowStoreHome getHome(java.util.Hashtable JavaDoc environment) throws javax.naming.NamingException JavaDoc {
55         // Obtain initial context
56
javax.naming.InitialContext JavaDoc initialContext = new javax.naming.InitialContext JavaDoc(environment);
57
58         try {
59             java.lang.Object JavaDoc objRef = initialContext.lookup(COMP_NAME);
60
61             return (com.opensymphony.workflow.spi.ejb.WorkflowStoreHome) javax.rmi.PortableRemoteObject.narrow(objRef, com.opensymphony.workflow.spi.ejb.WorkflowStoreHome.class);
62         } finally {
63             initialContext.close();
64         }
65     }
66 }
67
Popular Tags