1 21 package oracle.toplink.essentials.internal.ejb.cmp3.naming.base; 23 24 import java.util.Hashtable ; 25 import javax.naming.*; 26 27 public abstract class InitialContextImpl implements Context { 28 Hashtable env; 29 30 static Hashtable stringNamespace = new Hashtable (); 32 static Hashtable namespace = new Hashtable (); 33 34 35 36 37 protected abstract Object handleEntityManagerFactory(Object obj); 38 39 protected void debug(String s) { 40 System.out.println(s); 41 } 42 43 public InitialContextImpl() { 44 } 45 46 public InitialContextImpl(Hashtable env) { 47 this.env = env; 48 } 49 50 public Object internalLookup(Object name) { 51 Object obj = stringNamespace.get(name); 53 54 if (obj == null) { 56 obj = namespace.get(name); 57 } 58 59 if (obj == null) { 61 return null; 62 } 63 debug("Ctx - JNDI lookup, name=" + name + " value=" + obj); 64 66 return handleEntityManagerFactory(obj); 67 } 68 69 70 71 72 public Object lookup(String name) throws NamingException { 73 Object obj = internalLookup(name); 74 if (obj == null) { 75 throw new NameNotFoundException(name); 76 } 77 return obj; 78 } 79 80 public Object lookup(Name name) throws NamingException { 81 Object obj = internalLookup(name); 82 if (obj == null) { 83 throw new NameNotFoundException(name.toString()); 84 } 85 return obj; 86 } 87 88 public void bind(String name, Object obj) throws NamingException { 89 if (internalLookup(name) != null) { 90 throw new NameAlreadyBoundException(name); 91 } 92 rebind(name, obj); 93 } 94 95 public void bind(Name name, Object obj) throws NamingException { 96 if (internalLookup(name) != null) { 97 throw new NameAlreadyBoundException(name.toString()); 98 } 99 rebind(name, obj); 100 } 101 102 public void rebind(String name, Object obj) throws NamingException { 103 stringNamespace.put(name, obj); 104 rebind(new CompositeName(name), obj); 107 } 108 109 public void rebind(Name name, Object obj) throws NamingException { 110 namespace.put(name, obj); 111 } 112 113 public Hashtable getEnvironment() throws NamingException { 114 return env; 115 } 116 117 public void close() throws NamingException { 118 } 119 120 121 122 123 public void unbind(Name name) throws NamingException { 124 } 125 126 public void unbind(String name) throws NamingException { 127 } 128 129 public void rename(Name oldName, Name newName) throws NamingException { 130 } 131 132 public void rename(String oldName, String newName) throws NamingException { 133 } 134 135 public NamingEnumeration list(Name name) throws NamingException { 136 return null; 137 } 138 139 public NamingEnumeration list(String name) throws NamingException { 140 return null; 141 } 142 143 public NamingEnumeration listBindings(Name name) throws NamingException { 144 return null; 145 } 146 147 public NamingEnumeration listBindings(String name) throws NamingException { 148 return null; 149 } 150 151 public void destroySubcontext(Name name) throws NamingException { 152 } 153 154 public void destroySubcontext(String name) throws NamingException { 155 } 156 157 public Context createSubcontext(Name name) throws NamingException { 158 return null; 159 } 160 161 public Context createSubcontext(String name) throws NamingException { 162 return null; 163 } 164 165 public Object lookupLink(Name name) throws NamingException { 166 return null; 167 } 168 169 public Object lookupLink(String name) throws NamingException { 170 return null; 171 } 172 173 public NameParser getNameParser(Name name) throws NamingException { 174 return null; 175 } 176 177 public NameParser getNameParser(String name) throws NamingException { 178 return null; 179 } 180 181 public Name composeName(Name name, Name prefix) throws NamingException { 182 return null; 183 } 184 185 public String composeName(String name, String prefix) throws NamingException { 186 return null; 187 } 188 189 public Object addToEnvironment(String propName, Object propVal) throws NamingException { 190 return null; 191 } 192 193 public Object removeFromEnvironment(String propName) throws NamingException { 194 return null; 195 } 196 197 public String getNameInNamespace() throws NamingException { 198 return null; 199 } 200 } 201 | Popular Tags |