1 7 package org.jboss.media.entity; 8 9 12 public class MediaEntityManagerUtil 13 { 14 15 private static org.jboss.media.entity.MediaEntityManagerHome cachedRemoteHome = null; 16 17 18 private static org.jboss.media.entity.MediaEntityManagerLocalHome cachedLocalHome = null; 19 20 22 26 public static org.jboss.media.entity.MediaEntityManagerHome getHome() throws javax.naming.NamingException 27 { 28 if (cachedRemoteHome == null) { 29 javax.naming.InitialContext initialContext = new javax.naming.InitialContext (); 31 try { 32 java.lang.Object objRef = initialContext.lookup(org.jboss.media.entity.MediaEntityManagerHome.JNDI_NAME); 33 cachedRemoteHome = (org.jboss.media.entity.MediaEntityManagerHome) javax.rmi.PortableRemoteObject.narrow(objRef, org.jboss.media.entity.MediaEntityManagerHome.class); 34 } finally { 35 initialContext.close(); 36 } 37 } 38 return cachedRemoteHome; 39 } 40 41 46 public static org.jboss.media.entity.MediaEntityManagerHome getHome( java.util.Hashtable environment ) throws javax.naming.NamingException 47 { 48 javax.naming.InitialContext initialContext = new javax.naming.InitialContext (environment); 50 try { 51 java.lang.Object objRef = initialContext.lookup(org.jboss.media.entity.MediaEntityManagerHome.JNDI_NAME); 52 return (org.jboss.media.entity.MediaEntityManagerHome) javax.rmi.PortableRemoteObject.narrow(objRef, org.jboss.media.entity.MediaEntityManagerHome.class); 53 } finally { 54 initialContext.close(); 55 } 56 } 57 58 62 public static org.jboss.media.entity.MediaEntityManagerLocalHome getLocalHome() throws javax.naming.NamingException 63 { 64 if (cachedLocalHome == null) { 66 javax.naming.InitialContext initialContext = new javax.naming.InitialContext (); 68 try { 69 cachedLocalHome = (org.jboss.media.entity.MediaEntityManagerLocalHome) initialContext.lookup(org.jboss.media.entity.MediaEntityManagerLocalHome.JNDI_NAME); 70 } finally { 71 initialContext.close(); 72 } 73 } 74 return cachedLocalHome; 75 } 76 77 } | Popular Tags |