1 16 17 18 package org.apache.naming; 19 20 import java.util.Hashtable ; 21 import javax.naming.Context ; 22 import javax.naming.Name ; 23 import javax.naming.NameParser ; 24 import javax.naming.NamingEnumeration ; 25 import javax.naming.NamingException ; 26 27 33 public class SynchronizedContext implements Context { 34 35 36 public static final String SYNCHRONIZED = 37 "org.apache.naming.synchronization"; 38 39 40 private Context context; 41 42 47 public SynchronizedContext(Context context) { 48 this.context = context; 49 } 50 51 67 public synchronized Object lookup(Name name) 68 throws NamingException { 69 return this.context.lookup(name); 70 } 71 72 79 public synchronized Object lookup(String name) 80 throws NamingException { 81 return this.context.lookup(name); 82 } 83 84 96 public synchronized void bind(Name name, Object obj) 97 throws NamingException { 98 this.context.bind(name, obj); 99 } 100 101 111 public synchronized void bind(String name, Object obj) 112 throws NamingException { 113 this.context.bind(name, obj); 114 } 115 116 131 public synchronized void rebind(Name name, Object obj) 132 throws NamingException { 133 this.context.rebind(name, obj); 134 } 135 136 145 public synchronized void rebind(String name, Object obj) 146 throws NamingException { 147 this.context.rebind(name, obj); 148 } 149 150 164 public synchronized void unbind(Name name) 165 throws NamingException { 166 this.context.unbind(name); 167 } 168 169 177 public synchronized void unbind(String name) 178 throws NamingException { 179 this.context.unbind(name); 180 } 181 182 193 public synchronized void rename(Name oldName, Name newName) 194 throws NamingException { 195 this.context.rename(oldName, newName); 196 } 197 198 207 public synchronized void rename(String oldName, String newName) 208 throws NamingException { 209 this.context.rename(oldName, newName); 210 } 211 212 225 public synchronized NamingEnumeration list(Name name) 226 throws NamingException { 227 return this.context.list(name); 228 } 229 230 239 public synchronized NamingEnumeration list(String name) 240 throws NamingException { 241 return this.context.list(name); 242 } 243 244 257 public synchronized NamingEnumeration listBindings(Name name) 258 throws NamingException { 259 return this.context.listBindings(name); 260 } 261 262 271 public synchronized NamingEnumeration listBindings(String name) 272 throws NamingException { 273 return this.context.listBindings(name); 274 } 275 276 301 public synchronized void destroySubcontext(Name name) 302 throws NamingException { 303 this.context.destroySubcontext(name); 304 } 305 306 315 public synchronized void destroySubcontext(String name) 316 throws NamingException { 317 this.context.destroySubcontext(name); 318 } 319 320 338 public synchronized Context createSubcontext(Name name) 339 throws NamingException { 340 return this.context.createSubcontext(name); 341 } 342 343 358 public synchronized Context createSubcontext(String name) 359 throws NamingException { 360 return this.context.createSubcontext(name); 361 } 362 363 373 public synchronized Object lookupLink(Name name) 374 throws NamingException { 375 return this.context.lookupLink(name); 376 } 377 378 387 public synchronized Object lookupLink(String name) 388 throws NamingException { 389 return this.context.lookupLink(name); 390 } 391 392 406 public NameParser getNameParser(Name name) 407 throws NamingException { 408 return this.context.getNameParser(name); 409 } 410 411 419 public NameParser getNameParser(String name) 420 throws NamingException { 421 return this.context.getNameParser(name); 422 } 423 424 439 public Name composeName(Name name, Name prefix) 440 throws NamingException { 441 return this.context.composeName(name, prefix); 442 } 443 444 452 public String composeName(String name, String prefix) 453 throws NamingException { 454 return this.context.composeName(name, prefix); 455 } 456 457 466 public Object addToEnvironment(String propName, Object propVal) 467 throws NamingException { 468 return this.context.addToEnvironment(propName, propVal); 469 } 470 471 478 public Object removeFromEnvironment(String propName) 479 throws NamingException { 480 return this.context.removeFromEnvironment(propName); 481 } 482 483 493 public Hashtable getEnvironment() 494 throws NamingException { 495 return this.context.getEnvironment(); 496 } 497 498 508 public void close() 509 throws NamingException { 510 this.context.close(); 511 } 512 513 530 public String getNameInNamespace() 531 throws NamingException { 532 return this.context.getNameInNamespace(); 533 } 534 535 543 public static boolean isSynchronized(Hashtable environment) { 544 if (environment != null) { 545 Object prop = environment.get(SYNCHRONIZED); 546 if (prop instanceof String ) { 547 return Boolean.valueOf((String )prop).booleanValue(); 548 } 549 } 550 return false; 551 } 552 553 } 554 555 | Popular Tags |