1 5 8 package com.opensymphony.workflow.ejb; 9 10 11 17 public class WorkflowHomeFactory { 18 20 public static final String COMP_NAME = "java:comp/env/ejb/Workflow"; 21 public static final String JNDI_NAME = "Workflow"; 22 23 24 private static com.opensymphony.workflow.ejb.WorkflowHome cachedRemoteHome = null; 25 26 28 30 34 public static com.opensymphony.workflow.ejb.WorkflowHome getHome() throws javax.naming.NamingException { 35 if (cachedRemoteHome == null) { 36 javax.naming.InitialContext initialContext = new javax.naming.InitialContext (); 38 39 try { 40 java.lang.Object 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 55 public static com.opensymphony.workflow.ejb.WorkflowHome getHome(java.util.Hashtable environment) throws javax.naming.NamingException { 56 javax.naming.InitialContext initialContext = new javax.naming.InitialContext (environment); 58 59 try { 60 java.lang.Object 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 |