1 7 package org.ejtools.jndi.browser.web; 8 9 import java.beans.beancontext.BeanContextServicesSupport ; 10 import java.util.Collection ; 11 12 import org.ejtools.jndi.browser.model.Server; 13 14 22 public class JNDIContainer extends BeanContextServicesSupport 23 { 24 25 protected ClassLoader classLoader = null; 26 27 protected Server server; 28 29 30 31 public JNDIContainer() 32 { 33 try 34 { 35 this.server = new Server(); 36 this.add(this.server); 37 } 38 catch (Exception e) 39 { 40 e.printStackTrace(); 41 } 42 } 43 44 45 50 public ClassLoader getClassLoader() 51 { 52 return this.classLoader; 53 } 54 55 56 61 public String getName() 62 { 63 return this.server.getName(); 64 } 65 66 67 72 public Collection getServer() 73 { 74 return this.server; 75 } 76 77 78 79 public void refresh() 80 { 81 ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); 82 if (currentClassLoader.equals(this.classLoader)) 83 { 84 this.server.refresh(); 85 } 86 else 87 { 88 Thread.currentThread().setContextClassLoader(this.classLoader); 89 this.server.refresh(); 90 Thread.currentThread().setContextClassLoader(currentClassLoader); 91 } 92 } 93 94 95 100 public void setClassLoader(ClassLoader classLoader) 101 { 102 this.classLoader = classLoader; 103 } 104 105 106 111 public void setContext(String context) 112 { 113 this.server.setContext(context); 114 } 115 116 117 122 public void setName(String name) 123 { 124 this.server.setName(name); 125 } 126 } 127 | Popular Tags |