KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > workflow > ejb > WorkflowHomeFactory


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.ejb;
9
10
11 /**
12  * Utility class for Workflow.
13  * @author <a HREF="mailto:plightbo@hotmail.com">Pat Lightbody</a>
14  * @author <a HREF="mailto:hani@formicary.net">Hani Suleiman</a>
15  * @version $Revision: 1.5 $
16  */

17 public class WorkflowHomeFactory {
18     //~ Static fields/initializers /////////////////////////////////////////////
19

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

28     // Home interface lookup methods
29

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

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

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