1 23 package com.sun.enterprise.naming; 24 25 import java.rmi.*; 26 import java.util.logging.*; 27 import java.util.*; 28 import java.io.*; 29 import javax.naming.*; 30 import com.sun.logging.*; 31 32 import com.sun.enterprise.util.*; 33 34 39 40 public class LocalSerialContextProviderImpl 41 extends SerialContextProviderImpl { 42 43 private static LocalStringManagerImpl localStrings = 44 new LocalStringManagerImpl(LocalSerialContextProviderImpl.class); 45 46 static Logger _logger=LogDomains.getLogger(LogDomains.JNDI_LOGGER); 47 48 LocalSerialContextProviderImpl(TransientContext rootContext) throws RemoteException { 49 super(rootContext); 50 } 51 52 static LocalSerialContextProviderImpl getProvider( 53 TransientContext rootContext) { 54 try { 55 return new LocalSerialContextProviderImpl(rootContext); 56 } catch (RemoteException re) { 57 _logger.log(Level.SEVERE, 58 localStrings.getLocalString("local.provider.null", 59 "Exception occurred. Returning null provider : {0}" , 60 new Object [] {re.getMessage()})); 61 return null; 62 } 63 } 64 65 72 73 public void bind(String name, Object obj) 74 throws NamingException, RemoteException { 75 76 Object copyOfObj = NamingUtils.makeCopyOfObject(obj); 77 super.bind(name, copyOfObj); 78 } 79 80 81 88 89 public void rebind(String name, Object obj) 90 throws NamingException, RemoteException { 91 92 Object copyOfObj = NamingUtils.makeCopyOfObject(obj); 93 super.rebind(name, copyOfObj); 94 } 95 96 public Object lookup(String name) 97 throws NamingException, RemoteException { 98 Object obj = super.lookup(name); 99 try { 102 if( obj instanceof Reference ) { 103 Reference ref = (Reference) obj; 104 if( ref.getFactoryClassName().equals 105 (NamingManagerImpl.IIOPOBJECT_FACTORY)) { 106 107 Hashtable env = new Hashtable(); 108 org.omg.CORBA.ORB orb = ORBManager.getORB(); 109 env.put("java.naming.corba.orb", orb); 110 obj = javax.naming.spi.NamingManager.getObjectInstance 111 (obj, new CompositeName(name), null, env); 112 return obj; 113 } 114 } 115 return NamingUtils.makeCopyOfObject(obj); 116 } catch(RemoteException re) { 117 throw re; 118 } catch(Exception e) { 119 RemoteException re = new RemoteException("", e); 120 throw re; 121 122 } 123 } 124 } 125 | Popular Tags |