KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejtools > jndi > browser > web > JNDIContainer


1 /*
2  * EJTools, the Enterprise Java Tools
3  *
4  * Distributable under LGPL license.
5  * See terms of license at www.gnu.org.
6  */

7 package org.ejtools.jndi.browser.web;
8
9 import java.beans.beancontext.BeanContextServicesSupport JavaDoc;
10 import java.util.Collection JavaDoc;
11
12 import org.ejtools.jndi.browser.model.Server;
13
14 /**
15  * Description of the Class
16  *
17  * @author letiemble
18  * @created 25 avril 2002
19  * @version $Revision: 1.3 $
20  * @todo Javadoc to complete
21  */

22 public class JNDIContainer extends BeanContextServicesSupport JavaDoc
23 {
24    /** Description of the Field */
25    protected ClassLoader JavaDoc classLoader = null;
26    /** Description of the Field */
27    protected Server server;
28
29
30    /** Constructor for the JMXTree object */
31    public JNDIContainer()
32    {
33       try
34       {
35          this.server = new Server();
36          this.add(this.server);
37       }
38       catch (Exception JavaDoc e)
39       {
40          e.printStackTrace();
41       }
42    }
43
44
45    /**
46     * Returns the classLoader.
47     *
48     * @return ClassLoader
49     */

50    public ClassLoader JavaDoc getClassLoader()
51    {
52       return this.classLoader;
53    }
54
55
56    /**
57     * Gets the name attribute of the JNDIContainer object
58     *
59     * @return The name value
60     */

61    public String JavaDoc getName()
62    {
63       return this.server.getName();
64    }
65
66
67    /**
68     * Getter for the server attribute
69     *
70     * @return The value of server attribute
71     */

72    public Collection JavaDoc getServer()
73    {
74       return this.server;
75    }
76
77
78    /** Description of the Method */
79    public void refresh()
80    {
81       ClassLoader JavaDoc 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    /**
96     * Sets the classLoader.
97     *
98     * @param classLoader The classLoader to set
99     */

100    public void setClassLoader(ClassLoader JavaDoc classLoader)
101    {
102       this.classLoader = classLoader;
103    }
104
105
106    /**
107     * Sets the context attribute of the JNDIContainer object
108     *
109     * @param context The new context value
110     */

111    public void setContext(String JavaDoc context)
112    {
113       this.server.setContext(context);
114    }
115
116
117    /**
118     * Sets the name attribute of the JNDIContainer object
119     *
120     * @param name The new name value
121     */

122    public void setName(String JavaDoc name)
123    {
124       this.server.setName(name);
125    }
126 }
127
Popular Tags