KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mx4j > tools > config > DefaultConfigurationBuilder


1 /*
2  * Copyright (C) The MX4J Contributors.
3  * All rights reserved.
4  *
5  * This software is distributed under the terms of the MX4J License version 1.0.
6  * See the terms of the MX4J License in the documentation provided with this software.
7  */

8
9 package mx4j.tools.config;
10
11 import java.io.BufferedInputStream JavaDoc;
12 import java.io.IOException JavaDoc;
13 import java.io.InputStream JavaDoc;
14 import java.io.InterruptedIOException JavaDoc;
15 import java.lang.reflect.Constructor JavaDoc;
16 import java.lang.reflect.InvocationTargetException JavaDoc;
17 import java.lang.reflect.Method JavaDoc;
18 import java.net.InetAddress JavaDoc;
19 import java.net.ServerSocket JavaDoc;
20 import java.net.Socket JavaDoc;
21 import java.util.ArrayList JavaDoc;
22 import java.util.HashMap JavaDoc;
23 import java.util.List JavaDoc;
24 import java.util.Map JavaDoc;
25
26 import javax.management.Attribute JavaDoc;
27 import javax.management.MBeanServer JavaDoc;
28 import javax.management.MalformedObjectNameException JavaDoc;
29 import javax.management.ObjectName JavaDoc;
30
31 import mx4j.log.Log;
32 import mx4j.log.Logger;
33 import org.w3c.dom.Element JavaDoc;
34 import org.w3c.dom.NamedNodeMap JavaDoc;
35
36 /**
37  * @version $Revision: 1.8 $
38  */

39 public class DefaultConfigurationBuilder implements ConfigurationBuilder
40 {
41    public static final String JavaDoc SHUTDOWN_COMMAND = "shutdown";
42    public static final String JavaDoc RESTART_COMMAND = "restart";
43
44    private static final String JavaDoc NULL = "null";
45
46    public Node createConfigurationNode(Element JavaDoc node) throws ConfigurationException
47    {
48       String JavaDoc loweredName = node.getNodeName().toLowerCase();
49       StringBuffer JavaDoc buffer = new StringBuffer JavaDoc(loweredName);
50       buffer.replace(0, 1, loweredName.substring(0, 1).toUpperCase());
51       String JavaDoc className = getClass().getName() + "$" + buffer.toString();
52       try
53       {
54          Logger logger = getLogger();
55          if (logger.isEnabledFor(Logger.TRACE)) logger.trace("Creating configuration node " + className);
56          return (ConfigurationBuilder.Node)getClass().getClassLoader().loadClass(className).newInstance();
57       }
58       catch (Exception JavaDoc x)
59       {
60          throw new ConfigurationException(x);
61       }
62    }
63
64    private static Logger getLogger()
65    {
66       return Log.getLogger(DefaultConfigurationBuilder.class.getName());
67    }
68
69    public abstract static class AbstractNode implements Node
70    {
71       private String JavaDoc text;
72       private Node parent;
73       private List JavaDoc children;
74
75       public void setText(String JavaDoc text)
76       {
77          this.text = text;
78       }
79
80       public void setParent(Node parent)
81       {
82          this.parent = parent;
83       }
84
85       public void addChild(Node child)
86       {
87          if (children == null) children = new ArrayList JavaDoc();
88          child.setParent(this);
89          children.add(child);
90       }
91
92       protected String JavaDoc getText()
93       {
94          return text;
95       }
96
97       public Node getParent()
98       {
99          return parent;
100       }
101
102       public List JavaDoc getChildren()
103       {
104          return children;
105       }
106
107       public void setAttributes(NamedNodeMap JavaDoc attributes) throws ConfigurationException
108       {
109          Logger logger = getLogger();
110          for (int i = 0; i < attributes.getLength(); ++i)
111          {
112             org.w3c.dom.Node JavaDoc attribute = attributes.item(i);
113             String JavaDoc name = attribute.getNodeName();
114             String JavaDoc value = attribute.getNodeValue();
115             String JavaDoc setterName = "set" + name.substring(0, 1).toUpperCase() + name.substring(1);
116             try
117             {
118                if (logger.isEnabledFor(Logger.TRACE)) logger.trace("Calling " + setterName + " with " + value + " on " + this);
119                Method JavaDoc setter = getClass().getMethod(setterName, new Class JavaDoc[]{String JavaDoc.class});
120                setter.invoke(this, new java.lang.Object JavaDoc[]{value});
121             }
122             catch (InvocationTargetException JavaDoc x)
123             {
124                throw new ConfigurationException(x.getTargetException());
125             }
126             catch (Exception JavaDoc x)
127             {
128                throw new ConfigurationException(x);
129             }
130          }
131       }
132    }
133
134    public static class Configuration extends AbstractNode implements ObjectsHolder, Runnable JavaDoc
135    {
136       private Map JavaDoc objects;
137       private int port = -1;
138       private MBeanServer JavaDoc server;
139       private Thread JavaDoc thread;
140
141       public void setPort(String JavaDoc portString)
142       {
143          this.port = Integer.parseInt(portString);
144       }
145
146       public java.lang.Object JavaDoc configure(MBeanServer JavaDoc server) throws ConfigurationException
147       {
148          if (server != null)
149          {
150             this.server = server;
151             return startup(server);
152          }
153          else
154          {
155             return shutdown(this.server);
156          }
157       }
158
159       private java.lang.Object JavaDoc startup(MBeanServer JavaDoc server) throws ConfigurationException
160       {
161          Logger logger = getLogger();
162          List JavaDoc children = getChildren();
163          if (children != null)
164          {
165             for (int i = 0; i < children.size(); ++i)
166             {
167                Node child = (Node)children.get(i);
168                if (child instanceof DefaultConfigurationBuilder.Startup) child.configure(server);
169             }
170          }
171          if (port > 0)
172          {
173             thread = new Thread JavaDoc(this, "Configuration Shutdown");
174             if (logger.isEnabledFor(Logger.TRACE)) logger.trace("Starting " + thread.getName() + " Thread on port " + port);
175             thread.start();
176          }
177          return null;
178       }
179
180       private java.lang.Object JavaDoc shutdown(MBeanServer JavaDoc server) throws ConfigurationException
181       {
182          Logger logger = getLogger();
183          List JavaDoc children = getChildren();
184          if (children != null)
185          {
186             for (int i = 0; i < children.size(); ++i)
187             {
188                Node child = (Node)children.get(i);
189                if (child instanceof DefaultConfigurationBuilder.Shutdown) child.configure(server);
190             }
191          }
192          if (port > 0)
193          {
194             if (logger.isEnabledFor(Logger.TRACE)) logger.trace("Stopping " + thread.getName() + " Thread on port " + port);
195             thread.interrupt();
196          }
197          return null;
198       }
199
200       public void run()
201       {
202          Logger logger = getLogger();
203          ServerSocket JavaDoc server = null;
204          try
205          {
206             if (logger.isEnabledFor(Logger.TRACE)) logger.trace("Started " + thread.getName() + " Thread on port " + port);
207
208             server = new ServerSocket JavaDoc(port, 50, InetAddress.getByName(null));
209             server.setSoTimeout(1000);
210
211             byte[] buffer = new byte[64];
212             StringBuffer JavaDoc command = new StringBuffer JavaDoc();
213             while (!thread.isInterrupted())
214             {
215                Socket JavaDoc client = null;
216                try
217                {
218                   client = server.accept();
219                }
220                catch (InterruptedIOException JavaDoc x)
221                {
222                   continue;
223                }
224                if (logger.isEnabledFor(Logger.TRACE)) logger.trace("Client connected " + client);
225                InputStream JavaDoc is = new BufferedInputStream JavaDoc(client.getInputStream());
226
227                command.setLength(0);
228                int read = -1;
229                while ((read = is.read(buffer)) >= 0) command.append(new String JavaDoc(buffer, 0, read));
230
231                String JavaDoc cmd = command.toString();
232                if (logger.isEnabledFor(Logger.TRACE)) logger.trace("Got command '" + cmd + "'");
233
234                if (SHUTDOWN_COMMAND.equals(cmd))
235                {
236                   try
237                   {
238                      configure(null);
239                      break;
240                   }
241                   catch (ConfigurationException x)
242                   {
243                      if (logger.isEnabledFor(Logger.WARN)) logger.warn("Bad configuration for shutdown", x);
244                   }
245                }
246             }
247          }
248          catch (Exception JavaDoc x)
249          {
250             if (logger.isEnabledFor(Logger.INFO)) logger.info("Caught Exception in " + thread.getName() + " Thread, exiting", x);
251          }
252          finally
253          {
254             if (logger.isEnabledFor(Logger.TRACE)) logger.trace("Stopped " + thread.getName() + " Thread on port " + port);
255             try
256             {
257                if (server != null) server.close();
258             }
259             catch (IOException JavaDoc x)
260             {
261             }
262          }
263       }
264
265       public java.lang.Object JavaDoc getObject(String JavaDoc key)
266       {
267          if (objects == null) return null;
268          return objects.get(key);
269       }
270
271       public java.lang.Object JavaDoc putObject(String JavaDoc key, java.lang.Object JavaDoc value)
272       {
273          if (objects == null) objects = new HashMap JavaDoc();
274          return objects.put(key, value);
275       }
276
277       public boolean containsKey(String JavaDoc key)
278       {
279          if (objects == null) return false;
280          return objects.containsKey(key);
281       }
282    }
283
284    public static class Startup extends AbstractNode
285    {
286       public java.lang.Object JavaDoc configure(MBeanServer JavaDoc server) throws ConfigurationException
287       {
288          List JavaDoc children = getChildren();
289          if (children != null)
290          {
291             for (int i = 0; i < children.size(); ++i)
292             {
293                Node child = (Node)children.get(i);
294                child.configure(server);
295             }
296          }
297          return null;
298       }
299    }
300
301    public static class Shutdown extends AbstractNode
302    {
303       public java.lang.Object JavaDoc configure(MBeanServer JavaDoc server) throws ConfigurationException
304       {
305          List JavaDoc children = getChildren();
306          if (children != null)
307          {
308             for (int i = 0; i < children.size(); ++i)
309             {
310                Node child = (Node)children.get(i);
311                child.configure(server);
312             }
313          }
314          return null;
315       }
316    }
317
318    public static class Object extends AbstractNode
319    {
320       private String JavaDoc id;
321
322       public void setObjectid(String JavaDoc id)
323       {
324          this.id = id;
325       }
326
327       public String JavaDoc getObjectid()
328       {
329          return id;
330       }
331
332       public java.lang.Object JavaDoc configure(MBeanServer JavaDoc server) throws ConfigurationException
333       {
334          List JavaDoc children = getChildren();
335          java.lang.Object JavaDoc result = null;
336          if (children != null && children.size() > 0)
337          {
338             Node child = (Node)children.get(0);
339             result = child.configure(server);
340          }
341          putObject(this, id, result);
342          return result;
343       }
344    }
345
346    public static class New extends AbstractNode
347    {
348       private String JavaDoc classname;
349
350       public void setClassname(String JavaDoc classname)
351       {
352          this.classname = classname;
353       }
354
355       public java.lang.Object JavaDoc configure(MBeanServer JavaDoc server) throws ConfigurationException
356       {
357          try
358          {
359             Class JavaDoc cls = loadClass(classname);
360             Constructor JavaDoc ctor = cls.getConstructor(getMethodSignature(this));
361             return ctor.newInstance(getMethodArguments(this, server));
362          }
363          catch (InvocationTargetException JavaDoc x)
364          {
365             throw new ConfigurationException(x.getTargetException());
366          }
367          catch (ConfigurationException x)
368          {
369             throw x;
370          }
371          catch (Exception JavaDoc x)
372          {
373             throw new ConfigurationException(x);
374          }
375       }
376    }
377
378    public static class Arg extends AbstractNode
379    {
380       private static final String JavaDoc OBJECT_TYPE = "object";
381       private static final String JavaDoc STRING_TYPE = "string";
382       private static final String JavaDoc BOOLEAN_TYPE = "boolean";
383       private static final String JavaDoc BYTE_TYPE = "byte";
384       private static final String JavaDoc CHAR_TYPE = "char";
385       private static final String JavaDoc DOUBLE_TYPE = "double";
386       private static final String JavaDoc FLOAT_TYPE = "float";
387       private static final String JavaDoc INT_TYPE = "int";
388       private static final String JavaDoc LONG_TYPE = "long";
389       private static final String JavaDoc SHORT_TYPE = "short";
390
391       private String JavaDoc type;
392       private String JavaDoc refobjectid;
393
394       public void setType(String JavaDoc type)
395       {
396          this.type = type;
397       }
398
399       public void setRefobjectid(String JavaDoc refobjectid)
400       {
401          this.refobjectid = refobjectid;
402       }
403
404       public Class JavaDoc getJavaType() throws ConfigurationException
405       {
406          if (STRING_TYPE.equalsIgnoreCase(type)) return String JavaDoc.class;
407          if (OBJECT_TYPE.equalsIgnoreCase(type)) return java.lang.Object JavaDoc.class;
408          if (BOOLEAN_TYPE.equalsIgnoreCase(type)) return boolean.class;
409          if (BYTE_TYPE.equalsIgnoreCase(type)) return byte.class;
410          if (CHAR_TYPE.equalsIgnoreCase(type)) return char.class;
411          if (DOUBLE_TYPE.equalsIgnoreCase(type)) return double.class;
412          if (FLOAT_TYPE.equalsIgnoreCase(type)) return float.class;
413          if (INT_TYPE.equalsIgnoreCase(type)) return int.class;
414          if (LONG_TYPE.equalsIgnoreCase(type)) return long.class;
415          if (SHORT_TYPE.equalsIgnoreCase(type)) return short.class;
416          return loadClass(type);
417       }
418
419       public java.lang.Object JavaDoc configure(MBeanServer JavaDoc server) throws ConfigurationException
420       {
421          if (refobjectid != null) return getObject(this, refobjectid);
422
423          List JavaDoc children = getChildren();
424          if (children != null && children.size() > 0)
425          {
426             Node child = (Node)children.get(0);
427             return child.configure(server);
428          }
429
430          String JavaDoc text = getText();
431          if (text == null || NULL.equals(text)) return null;
432
433          if (STRING_TYPE.equalsIgnoreCase(type)) return text;
434          if (OBJECT_TYPE.equalsIgnoreCase(type)) return text;
435          if (BOOLEAN_TYPE.equalsIgnoreCase(type)) return Boolean.valueOf(text);
436          if (BYTE_TYPE.equalsIgnoreCase(type)) return Byte.valueOf(text);
437          if (CHAR_TYPE.equalsIgnoreCase(type)) return new Character JavaDoc(text.length() < 1 ? 0 : text.charAt(0));
438          if (DOUBLE_TYPE.equalsIgnoreCase(type)) return Double.valueOf(text);
439          if (FLOAT_TYPE.equalsIgnoreCase(type)) return Float.valueOf(text);
440          if (INT_TYPE.equalsIgnoreCase(type)) return Integer.valueOf(text);
441          if (LONG_TYPE.equalsIgnoreCase(type)) return Long.valueOf(text);
442          if (SHORT_TYPE.equalsIgnoreCase(type)) return Short.valueOf(text);
443
444          try
445          {
446             Constructor JavaDoc ctor = getJavaType().getConstructor(new Class JavaDoc[]{String JavaDoc.class});
447             return ctor.newInstance(new java.lang.Object JavaDoc[]{text});
448          }
449          catch (InvocationTargetException JavaDoc x)
450          {
451             throw new ConfigurationException(x.getTargetException());
452          }
453          catch (ConfigurationException x)
454          {
455             throw x;
456          }
457          catch (Exception JavaDoc x)
458          {
459             throw new ConfigurationException(x);
460          }
461       }
462    }
463
464    public static class Register extends AbstractNode
465    {
466       private ObjectName JavaDoc objectname;
467
468       public void setObjectname(String JavaDoc name) throws MalformedObjectNameException JavaDoc
469       {
470          if (name != null && !NULL.equals(name)) this.objectname = ObjectName.getInstance(name);
471       }
472
473       public java.lang.Object JavaDoc configure(MBeanServer JavaDoc server) throws ConfigurationException
474       {
475          List JavaDoc children = getChildren();
476          if (children != null && children.size() > 0)
477          {
478             Node child = (Node)children.get(0);
479             try
480             {
481                return server.registerMBean(child.configure(server), objectname);
482             }
483             catch (ConfigurationException x)
484             {
485                throw x;
486             }
487             catch (Exception JavaDoc x)
488             {
489                throw new ConfigurationException(x);
490             }
491          }
492          return null;
493       }
494    }
495
496    public static class Unregister extends AbstractNode
497    {
498       private ObjectName JavaDoc objectname;
499
500       public void setObjectname(String JavaDoc name) throws MalformedObjectNameException JavaDoc
501       {
502          this.objectname = ObjectName.getInstance(name);
503       }
504
505       public java.lang.Object JavaDoc configure(MBeanServer JavaDoc server) throws ConfigurationException
506       {
507          try
508          {
509             server.unregisterMBean(objectname);
510             return null;
511          }
512          catch (Exception JavaDoc x)
513          {
514             throw new ConfigurationException(x);
515          }
516       }
517    }
518
519    public static class Create extends AbstractNode
520    {
521       private String JavaDoc classname;
522       private ObjectName JavaDoc objectname;
523       private String JavaDoc loadername;
524
525       public void setClassname(String JavaDoc classname)
526       {
527          this.classname = classname;
528       }
529
530       public void setObjectname(String JavaDoc name) throws MalformedObjectNameException JavaDoc
531       {
532          if (name != null && !NULL.equals(name)) this.objectname = ObjectName.getInstance(name);
533       }
534
535       public void setLoadername(String JavaDoc name) throws MalformedObjectNameException JavaDoc
536       {
537          this.loadername = name;
538       }
539
540       public java.lang.Object JavaDoc configure(MBeanServer JavaDoc server) throws ConfigurationException
541       {
542          try
543          {
544             if (loadername != null)
545             {
546                ObjectName JavaDoc loader = null;
547                if (!NULL.equals(loadername)) loader = ObjectName.getInstance(loadername);
548                return server.createMBean(classname, objectname, loader, getMethodArguments(this, server), getJMXMethodSignature(this));
549             }
550             else
551             {
552                return server.createMBean(classname, objectname, getMethodArguments(this, server), getJMXMethodSignature(this));
553             }
554          }
555          catch (ConfigurationException x)
556          {
557             throw x;
558          }
559          catch (Exception JavaDoc x)
560          {
561             throw new ConfigurationException(x);
562          }
563       }
564    }
565
566    public static class Call extends AbstractNode
567    {
568       private String JavaDoc classname;
569       private ObjectName JavaDoc objectname;
570       private String JavaDoc refobjectid;
571       private String JavaDoc method;
572       private String JavaDoc operation;
573       private String JavaDoc attribute;
574
575       public void setClassname(String JavaDoc classname)
576       {
577          this.classname = classname;
578       }
579
580       public void setObjectname(String JavaDoc name) throws MalformedObjectNameException JavaDoc
581       {
582          if (name != null && !NULL.equals(name)) this.objectname = ObjectName.getInstance(name);
583       }
584
585       public void setRefobjectid(String JavaDoc refid)
586       {
587          this.refobjectid = refid;
588       }
589
590       public void setMethod(String JavaDoc method)
591       {
592          this.method = method;
593       }
594
595       public void setOperation(String JavaDoc operation)
596       {
597          this.operation = operation;
598       }
599
600       public void setAttribute(String JavaDoc attribute)
601       {
602          this.attribute = attribute;
603       }
604
605       public java.lang.Object JavaDoc configure(MBeanServer JavaDoc server) throws ConfigurationException
606       {
607          if (classname != null)
608          {
609             // Static call
610
Class JavaDoc cls = loadClass(classname);
611             try
612             {
613                Method JavaDoc mthd = cls.getMethod(method, getMethodSignature(this));
614                return mthd.invoke(null, getMethodArguments(this, server));
615             }
616             catch (InvocationTargetException JavaDoc x)
617             {
618                throw new ConfigurationException(x.getTargetException());
619             }
620             catch (ConfigurationException x)
621             {
622                throw x;
623             }
624             catch (Exception JavaDoc x)
625             {
626                throw new ConfigurationException(x);
627             }
628          }
629          else
630          {
631             if (objectname != null)
632             {
633                // JMX call
634
if (operation != null)
635                {
636                   try
637                   {
638                      return server.invoke(objectname, operation, getMethodArguments(this, server), getJMXMethodSignature(this));
639                   }
640                   catch (ConfigurationException x)
641                   {
642                      throw x;
643                   }
644                   catch (Exception JavaDoc x)
645                   {
646                      throw new ConfigurationException(x);
647                   }
648                }
649                else if (attribute != null)
650                {
651                   try
652                   {
653                      List JavaDoc children = getChildren();
654                      if (children == null || children.size() < 1)
655                      {
656                         return server.getAttribute(objectname, attribute);
657                      }
658                      else
659                      {
660                         java.lang.Object JavaDoc arg = getMethodArguments(this, server)[0];
661                         server.setAttribute(objectname, new Attribute JavaDoc(attribute, arg));
662                         return null;
663                      }
664                   }
665                   catch (ConfigurationException x)
666                   {
667                      throw x;
668                   }
669                   catch (Exception JavaDoc x)
670                   {
671                      throw new ConfigurationException(x);
672                   }
673                }
674                else
675                {
676                   throw new ConfigurationException("Missing 'attribute' or 'operation' attribute in JMX call");
677                }
678             }
679             else
680             {
681                // Standard call
682
java.lang.Object JavaDoc target = null;
683                if (refobjectid != null)
684                {
685                   target = getObject(this, refobjectid);
686                   if (target == null) throw new ConfigurationException("Could not find object with id " + refobjectid);
687                   try
688                   {
689                      Method JavaDoc mthd = target.getClass().getMethod(method, getMethodSignature(this));
690                      return mthd.invoke(target, getMethodArguments(this, server));
691                   }
692                   catch (InvocationTargetException JavaDoc x)
693                   {
694                      throw new ConfigurationException(x.getTargetException());
695                   }
696                   catch (ConfigurationException x)
697                   {
698                      throw x;
699                   }
700                   catch (Exception JavaDoc x)
701                   {
702                      throw new ConfigurationException(x);
703                   }
704                }
705                else
706                {
707                   throw new ConfigurationException("Missing 'refobjectid' attribute in call element");
708                }
709             }
710          }
711       }
712    }
713
714    private static Class JavaDoc[] getMethodSignature(Node node) throws ConfigurationException
715    {
716       List JavaDoc children = node.getChildren();
717       if (children == null) return null;
718       ArrayList JavaDoc signature = new ArrayList JavaDoc();
719       for (int i = 0; i < children.size(); ++i)
720       {
721          Node child = (Node)children.get(i);
722          if (child instanceof Arg)
723          {
724             Arg arg = (Arg)child;
725             signature.add(arg.getJavaType());
726          }
727       }
728       return (Class JavaDoc[])signature.toArray(new Class JavaDoc[signature.size()]);
729    }
730
731    private static String JavaDoc[] getJMXMethodSignature(Node node) throws ConfigurationException
732    {
733       Class JavaDoc[] signature = getMethodSignature(node);
734       if (signature == null) return null;
735
736       ArrayList JavaDoc jmxSignature = new ArrayList JavaDoc();
737       for (int i = 0; i < signature.length; ++i)
738       {
739          jmxSignature.add(signature[i].getName());
740       }
741       return (String JavaDoc[])jmxSignature.toArray(new String JavaDoc[jmxSignature.size()]);
742    }
743
744    private static java.lang.Object JavaDoc[] getMethodArguments(Node node, MBeanServer JavaDoc server) throws ConfigurationException
745    {
746       List JavaDoc children = node.getChildren();
747       if (children == null) return null;
748       ArrayList JavaDoc arguments = new ArrayList JavaDoc();
749       for (int i = 0; i < children.size(); ++i)
750       {
751          Node child = (Node)children.get(i);
752          if (child instanceof Arg)
753          {
754             Arg arg = (Arg)child;
755             arguments.add(arg.configure(server));
756          }
757       }
758       return arguments.toArray();
759    }
760
761    private static Class JavaDoc loadClass(String JavaDoc className) throws ConfigurationException
762    {
763       try
764       {
765          return Thread.currentThread().getContextClassLoader().loadClass(className);
766       }
767       catch (ClassNotFoundException JavaDoc x)
768       {
769          throw new ConfigurationException(x);
770       }
771    }
772
773    private static java.lang.Object JavaDoc getObject(Node node, String JavaDoc key)
774    {
775       while (node != null)
776       {
777          if (node instanceof ObjectsHolder)
778          {
779             ObjectsHolder holder = (ObjectsHolder)node;
780             if (holder.containsKey(key)) return holder.getObject(key);
781          }
782          node = node.getParent();
783       }
784       return null;
785    }
786
787    private static void putObject(Node node, String JavaDoc key, java.lang.Object JavaDoc value)
788    {
789       while (node != null)
790       {
791          if (node instanceof ObjectsHolder)
792          {
793             ObjectsHolder holder = (ObjectsHolder)node;
794             holder.putObject(key, value);
795          }
796          node = node.getParent();
797       }
798    }
799 }
800
Popular Tags