1 23 package com.sun.enterprise.naming; 24 25 import java.util.*; 26 import java.io.*; 27 import java.rmi.*; 28 import javax.naming.*; 29 import javax.rmi.PortableRemoteObject ; 30 31 32 import com.sun.enterprise.connectors.*; 33 34 import java.util.logging.*; 35 import com.sun.logging.*; 36 37 public class SerialContextProviderImpl implements SerialContextProvider { 38 39 static Logger _logger = LogDomains.getLogger(LogDomains.JNDI_LOGGER); 40 41 private TransientContext rootContext; 42 43 44 protected SerialContextProviderImpl(TransientContext rootContext) 45 throws RemoteException { 46 this.rootContext = rootContext; 47 } 48 49 55 56 public Object lookup(String name) 57 throws NamingException, RemoteException { 58 try { 59 _logger.fine(" SerialContextProviderImpl :: lookup " + name); 60 61 Object obj = rootContext.lookup(name); 62 return obj; 63 } catch(NamingException ne) { 64 boolean isLoaded = checkAndLoadResource(name); 65 _logger.fine("CheckAndLoad Resource of " + name + " was " + isLoaded ); 66 if ( isLoaded ) { 67 Object i = rootContext.lookup(name); 68 return i; 69 } 70 throw ne; 71 } catch(Exception e) { 72 _logger.severe("Exception occurred : " + e.getMessage()); 73 RemoteException re = new RemoteException("", e); 74 throw re; 75 76 } 77 } 78 79 private boolean checkAndLoadResource(String name) { 80 boolean res = false; 81 ConnectorRuntime connectorRuntime = ConnectorRuntime.getRuntime(); 82 if(connectorRuntime.isServer()) { 83 res = connectorRuntime.checkAndLoadResource(name); 84 } 85 return res; 86 } 87 88 89 94 95 public void bind(String name, Object obj) 96 throws NamingException, RemoteException { 97 98 rootContext.bind(name, obj); 99 } 100 101 106 107 public void rebind(String name, Object obj) 108 throws NamingException, RemoteException { 109 110 rootContext.rebind(name, obj); 111 } 112 113 118 119 public void unbind(String name) 120 throws NamingException, RemoteException { 121 122 rootContext.unbind(name); 123 } 124 125 130 131 public void rename(String oldname, String newname) 132 throws NamingException, RemoteException { 133 134 rootContext.rename(oldname, newname); 135 } 136 137 public Hashtable list() throws RemoteException { 138 139 return rootContext.list(); 140 } 141 142 147 148 public Hashtable list(String name) throws NamingException, RemoteException { 149 Hashtable ne = rootContext.listContext(name); 150 return ne; 151 } 152 153 159 160 public Context createSubcontext(String name) 161 throws NamingException, RemoteException { 162 163 Context ctx = rootContext.createSubcontext(name); 164 return ctx; 165 } 166 167 172 173 public void destroySubcontext(String name) 174 throws NamingException, RemoteException { 175 176 rootContext.destroySubcontext(name); 177 } 178 179 } 180 181 182 183 184 185 186 | Popular Tags |