1 23 24 package com.sun.ejb.containers; 25 26 import java.rmi.RemoteException ; 27 import javax.naming.Context ; 28 import javax.naming.InitialContext ; 29 import javax.rmi.PortableRemoteObject ; 30 31 import com.sun.ejb.containers.ReadOnlyEJBLocalHome; 32 import com.sun.ejb.containers.ReadOnlyEJBHome; 33 34 import java.util.logging.*; 35 import com.sun.logging.*; 36 37 import javax.ejb.EJBHome ; 38 39 47 public class ReadOnlyBeanHelper { 48 49 private static Logger _logger; 50 private static final boolean debug = false; 51 52 static { 53 _logger=LogDomains.getLogger(LogDomains.EJB_LOGGER); 54 } 55 56 62 public static com.sun.ejb.ReadOnlyBeanNotifier 63 getReadOnlyBeanNotifier(String ejbName) 64 { 65 try { 66 Context ctx = new InitialContext (); 67 Object obj = ctx.lookup(ejbName); 68 ReadOnlyEJBHome home = (ReadOnlyEJBHome) 69 PortableRemoteObject.narrow(obj, ReadOnlyEJBHome.class); 70 return new ReadOnlyBeanNotifierImpl(home); 71 } catch (Exception ex) { 72 if(_logger.isLoggable(Level.SEVERE)) { 73 _logger.log(Level.SEVERE,"ejb.remote_exception", ex); 74 } 75 } 76 return null; 77 } 78 79 85 public static com.sun.ejb.ReadOnlyBeanLocalNotifier 86 getReadOnlyBeanLocalNotifier(String ejbName) 87 { 88 try { 89 Context ctx = new InitialContext (); 90 ReadOnlyEJBLocalHome home = 91 (ReadOnlyEJBLocalHome) ctx.lookup(ejbName); 92 return (com.sun.ejb.ReadOnlyBeanLocalNotifier) 93 home.getReadOnlyBeanLocalNotifier(); 94 } catch (Exception ex) { 95 if(_logger.isLoggable(Level.SEVERE)) { 96 _logger.log(Level.SEVERE,"ejb.remote_exception",ex); 97 } 98 } 99 return null; 100 } 101 102 } 103 | Popular Tags |