KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > admingui > tree > IndexTreeNode


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.tools.admingui.tree;
25
26 import java.util.Map JavaDoc;
27 import java.util.HashMap JavaDoc;
28 import java.util.HashSet JavaDoc;
29 import java.util.List JavaDoc;
30 import java.util.ArrayList JavaDoc;
31 import java.util.Iterator JavaDoc;
32 import java.io.Serializable JavaDoc;
33 import java.io.IOException JavaDoc;
34 import java.lang.reflect.Constructor JavaDoc;
35
36 import javax.servlet.*;
37 import javax.servlet.http.*;
38 import javax.management.ObjectName JavaDoc;
39 import javax.management.MBeanServer JavaDoc;
40
41 import org.w3c.dom.Element JavaDoc;
42 import org.w3c.dom.Node JavaDoc;
43
44 import com.iplanet.jato.RequestContext;
45 import com.iplanet.jato.RequestManager;
46 import com.iplanet.jato.ViewBeanManager;
47 import com.iplanet.jato.view.ViewBean;
48 import com.iplanet.jato.view.TreeViewStateData;
49 import com.iplanet.jato.util.NonSyncStringBuffer;
50
51 import com.sun.enterprise.tools.admingui.util.Util;
52 import com.sun.enterprise.tools.admingui.util.MBeanUtil;
53 import com.sun.enterprise.tools.guiframework.exception.FrameworkException;
54 import com.sun.enterprise.tools.guiframework.view.DescriptorViewBeanBase;
55
56 public class IndexTreeNode extends Object JavaDoc implements Serializable JavaDoc {
57     
58     // Need to have a set of CONSTANT node IDs for tree highlighting.
59
// This maps names to IDs, assuming the names are constant.
60
private static HashMap JavaDoc idsMap = new HashMap JavaDoc();
61     private static int nodeCount = 3; // 1&2 reserved for links outside tree(domains).
62
private static String JavaDoc computeID(IndexTreeNode parent, IndexTreeNode child, String JavaDoc name) {
63     String JavaDoc key = child.getNamePath();
64     String JavaDoc id = (String JavaDoc)idsMap.get(key);
65     if (id == null) {
66         nodeCount++;
67         id = (String JavaDoc)(""+nodeCount);
68         idsMap.put(key, id);
69     }
70     return id;
71     }
72     
73     private String JavaDoc qualifyType(String JavaDoc type) {
74         if (type.equalsIgnoreCase(IndexTreeModel.CONTAINER)) {
75             return IndexTreeModel.CONTAINER;
76         } else if (type.equalsIgnoreCase(IndexTreeModel.LEAF)) {
77             return IndexTreeModel.LEAF;
78         } else if (type.equalsIgnoreCase(IndexTreeModel.ROOT)) {
79             return IndexTreeModel.ROOT;
80         }
81         throw new RuntimeException JavaDoc("Unknown node type specified. Error likely in treeXML.");
82     }
83
84     private String JavaDoc qualifyName(String JavaDoc name) {
85         if (name != null && name.length() > 0) {
86             return name;
87         }
88         throw new RuntimeException JavaDoc("Node name must be non-null and non-blank. "
89             + "Error likely in treeXML.");
90     }
91     
92     public IndexTreeNode(IndexTreeNode parent, String JavaDoc type, String JavaDoc name, IndexTreeModel model) {
93     super();
94     this.type = qualifyType(type);
95     this.name = qualifyName(name);
96     this.id = model.getNextNodeID();
97     this.model = model;
98         this.link = "underConstruction"; // default page to show if nothing is specified.
99
setParent(parent);
100         
101     setAttribute(IndexTreeModel.FIELD_NAME, name);
102     setAttribute(IndexTreeModel.FIELD_ID, getPath());
103         
104     
105     // when creating, needsrefresh is true;
106
// on first expansion, needs refresh is turned false.
107
// on refresh, needs refresh is true for all container nodes
108
setRefresh(true);
109     }
110     
111     public void setParent(IndexTreeNode parent) {
112     if (parent == null) {
113         parent = model.getRoot();
114     }
115     this.parent = parent;
116     
117     if (parent != null) {
118         parent.addChild(this);
119             
120             if (parent.getType().equals(IndexTreeModel.LEAF))
121                 parent.type = IndexTreeModel.CONTAINER;
122         }
123     this.hid=computeID(parent, this, name); // highlight ID
124
}
125         
126     public void removeChild(String JavaDoc childName) {
127     Iterator JavaDoc it = children.iterator();
128     while (it.hasNext()) {
129         IndexTreeNode childNode = (IndexTreeNode)it.next();
130         if (childNode.getName().equals(childName)) {
131         IndexTreeNode n = childNode.getParent();
132         if (n != null) {
133             n.children.remove(childNode);
134             break;
135         }
136         }
137     }
138     }
139     
140     public IndexTreeNode getChild(String JavaDoc childName) {
141     Iterator JavaDoc it = children.iterator();
142     while (it.hasNext()) {
143         IndexTreeNode childNode = (IndexTreeNode)it.next();
144         if (childNode.getName().equals(childName)) {
145                 return childNode;
146         }
147     }
148         return null;
149     }
150     
151     public IndexTreeNode getChildByUniqueID(String JavaDoc uniqueID) {
152     Iterator JavaDoc it = children.iterator();
153     while (it.hasNext()) {
154         IndexTreeNode childNode = (IndexTreeNode)it.next();
155             if (childNode.getUniqueID() != null) {
156                 if (childNode.getUniqueID().equals(uniqueID)) {
157                     return childNode;
158                 }
159             }
160     }
161         return null;
162     }
163     
164     public void addChild(IndexTreeNode child) {
165         String JavaDoc isCluster = null;
166         //Known Issues: Tree is stored in session so if there is a change add/remove a cluster/instance
167
//the config node is not updated and displayed properly. This is not a dynamic node b/c there are no mbeans or children
168
//so it does not get updated. Since we are moving to the JSF tree it does not make sense to
169
//have a fix.
170
//We have to make this generic for other nodes as well. We will fix this issue later.
171
if(child.getName().equalsIgnoreCase("Group Management Service")){
172             ObjectName JavaDoc[] targets = null;
173             try {
174                 targets = (ObjectName JavaDoc[])MBeanUtil.invoke("com.sun.appserv:type=config,name="+child.getParent().getName()+",category=config", "listReferencees", null, null);
175                 if (targets != null) {
176                     for (int j = 0; j < targets.length; j++) {
177                         
178                         String JavaDoc objectType = targets[j].getKeyProperty("type");
179                         isCluster = (objectType.equalsIgnoreCase("cluster"))?"true":"false";
180                     }
181                 }
182                 if(isCluster.equals("true"))
183                     children.add(child);
184             }catch (Exception JavaDoc ex) {
185                 
186                 return; //default-config..
187

188             }
189         } else {
190             children.add(child);
191         }
192     }
193
194     public void setDynamicChild(Element JavaDoc node) {
195         dynamicChild = node;
196     }
197     
198     protected void loadParams(Element JavaDoc node, HashMap JavaDoc params) {
199         for (Node JavaDoc child = node.getFirstChild(); child != null; child = child.getNextSibling()) {
200             String JavaDoc nodeName = child.getNodeName();
201             if (nodeName.equalsIgnoreCase("parameter")) {
202                 String JavaDoc name = ((Element JavaDoc)child).getAttribute("name");
203                 String JavaDoc value = ((Element JavaDoc)child).getAttribute("value");
204                 if (name != null && value != null) {
205                     value = replaceTokens(value);
206                     params.put(name, value);
207                 }
208             }
209         }
210     }
211     
212     protected IndexTreeNode createNode(Element JavaDoc element, String JavaDoc name, Object JavaDoc objectName) {
213         if (getChild(name) != null) {
214             return null;
215         }
216
217         IndexTreeNode treeNode = createNode(element, this,
218             IndexTreeModelImpl.LEAF, name, model);
219
220     
221         if (MBeanUtil.isValidMBean(objectName.toString())) {
222             treeNode.setAttribute(OBJECT_NAME, objectName.toString());
223         }
224
225         boolean hasChildren = TreeReader.process(element, model, treeNode);
226         if (hasChildren) {
227             treeNode.type = IndexTreeModel.CONTAINER;
228             treeNode.getChildren();
229         }
230         return treeNode;
231     }
232     
233     public static IndexTreeNode createNode(Element JavaDoc element, IndexTreeNode parent,
234         String JavaDoc nodeType, String JavaDoc name, IndexTreeModel model) {
235             
236         IndexTreeNode treeNode = null;
237         String JavaDoc classType = element.getAttribute("classType");
238         if (classType == null || classType.length() == 0) {
239             treeNode = new IndexTreeNode(parent, nodeType, name, model);
240         } else {
241             String JavaDoc clazz = TreeReader.getClass(classType);
242             if (clazz == null)
243                 throw new RuntimeException JavaDoc("NodeClassType not specified for: "+classType);
244             try {
245                 Class JavaDoc treeNodeClass = Class.forName(clazz);
246                 Constructor JavaDoc constructor = treeNodeClass.getConstructor(
247                     new Class JavaDoc[] {IndexTreeNode.class, String JavaDoc.class,
248                                  String JavaDoc.class, IndexTreeModel.class});
249
250                 treeNode = (IndexTreeNode)constructor.newInstance(
251                     new Object JavaDoc[] {parent, nodeType, name, model});
252             } catch (Exception JavaDoc ex) {
253                 throw new RuntimeException JavaDoc(ex);
254             }
255         }
256        
257         treeNode.setIcon(element.getAttribute("icon"));
258         treeNode.setIconExpanded(element.getAttribute("expandIcon"));
259         treeNode.setLink(element.getAttribute("link"));
260         
261         String JavaDoc id = element.getAttribute("id");
262         if (id != null && id.length() > 0)
263             treeNode.setUniqueID(id);
264
265         if (nodeType.equalsIgnoreCase(model.ROOT))
266             model.setRoot(treeNode);
267         processAttributes(element, treeNode);
268         return treeNode;
269     }
270     
271     private static void processAttributes(Element JavaDoc node, IndexTreeNode treeNode) {
272         for (Node JavaDoc child = node.getFirstChild(); child != null; child = child.getNextSibling()) {
273             String JavaDoc nodeName = child.getNodeName();
274             if (nodeName.equalsIgnoreCase("attribute")) {
275                 String JavaDoc name = ((Element JavaDoc)child).getAttribute("name");
276                 String JavaDoc value = ((Element JavaDoc)child).getAttribute("value");
277                 if (value == null || value.length() == 0) {
278                     ArrayList JavaDoc values = new ArrayList JavaDoc();
279                     for (Node JavaDoc n = child.getFirstChild(); n != null; n = n.getNextSibling()) {
280                         if (n.getNodeName().equalsIgnoreCase("values")) {
281                             String JavaDoc v = ((Element JavaDoc)n).getAttribute("value");
282                             if (v != null && v.length() > 0) {
283                                 v = treeNode.replaceTokens(v);
284                                 values.add(v);
285                             }
286                         }
287                     }
288                     if (values.size() > 0)
289                         treeNode.setAttribute(name, values);
290                 }
291                 else if (name != null && name.length() > 0 &&
292                          value != null && value.length() > 0) {
293                     value = treeNode.replaceTokens(value);
294                     treeNode.setAttribute(name, value);
295                 }
296             }
297         }
298     }
299
300    /*private static String getConfigName(String type, String objName) {
301         String configName = null;
302         try {
303             String objectName = "com.sun.appserv:type="+type+",name="+objName+",category=config";
304             configName = (String) MBeanUtil.getAttribute(objectName, "config_ref");
305         } catch (FrameworkException ex) {
306         if (Util.isLoggableINFO()) {
307         Util.logINFO("CAN'T GET CONFIG NAME....... "+ex.getMessage(), ex);
308         }
309         }
310         return configName;
311     }*/

312     
313     protected String JavaDoc replaceTokens(String JavaDoc str) {
314         if (str == null) return str;
315         return replaceVariableWithAttribute(str, "$", "(", ")", "");
316     }
317     // this was copied from the framework.... should call a framework method instead.
318
public String JavaDoc replaceVariableWithAttribute(String JavaDoc string, String JavaDoc startToken,
319             String JavaDoc typeDelim, String JavaDoc endToken, String JavaDoc valueForNull) {
320     int startIndex = string.lastIndexOf(startToken);
321     int delimIndex;
322     int endIndex;
323     int startTokenLen = startToken.length();
324     int delimLen = typeDelim.length();
325     int endTokenLen = endToken.length();
326     boolean expressionIsWholeString = false;
327
328     for (; startIndex != -1; startIndex = string.lastIndexOf(startToken)) {
329         // Handle special case where string starts with startToken and ends
330
// with endToken (and no replacements inbetween). This is special
331
// because we don't want to convert the attribute to a string, we
332
// want to return it (this allows Object types).
333
if ((startIndex == 0) && (string.endsWith(endToken))) {
334         // This is the special case...
335
expressionIsWholeString = true;
336         }
337
338         // Find first typeDelim
339
delimIndex = string.indexOf(typeDelim, startIndex+startTokenLen);
340         if (delimIndex == -1) {
341         continue;
342         }
343
344         // Next find first end token
345
endIndex = string.indexOf(endToken, delimIndex+delimLen);
346         if (endIndex == -1) {
347         continue;
348         }
349         // Pull off the type...
350
//type = string.substring(startIndex+startTokenLen, delimIndex);
351
if (startIndex+startTokenLen != delimIndex)
352                 throw new RuntimeException JavaDoc("types not support in tree expressions.");
353
354         // Pull off the variable...
355
String JavaDoc variable = string.substring(delimIndex+delimLen, endIndex);
356
357         // Get the value...
358
Object JavaDoc value = getAttribute(variable);
359         if (value == null) {
360         variable = valueForNull;
361         } else if ((value instanceof String JavaDoc) == false) {
362                 variable = value.toString();
363             } else {
364                 variable = (String JavaDoc) value;
365             }
366         if (expressionIsWholeString) {
367         return variable;
368         }
369         // Make new string
370
string = string.substring(0, startIndex) + // Before replacement
371
variable + // Replacement
372
string.substring(endIndex+endTokenLen); // After
373
}
374     return string;
375     }
376     
377     protected void removeDeletedNodes(HashSet JavaDoc newNames) {
378         // if any of the existing nodes are not in the newNames set, they are deleted.
379
if (newNames.size() != this.children.size()) {
380             // if the list sizes aren't the same, then check for deleted nodes
381
boolean doAgain = true;
382             while (doAgain) {
383                 doAgain = false;
384                 for (int i=0; i<this.children.size(); i++) {
385                     if (newNames.contains(((IndexTreeNode)this.children.get(i)).name) == false) {
386                         this.children.remove(i);
387                         doAgain = true;
388                         break;
389                     }
390                 }
391             }
392         }
393         if (this.children.size() == 0) {
394             closeNode(RequestManager.getRequestContext());
395         }
396     }
397
398     /* returns false if the node corresponding to objectName should not be added to tree.
399        if there is an exception trying to validate, still return true */

400      protected boolean isChildValid(ObjectName JavaDoc objectName) {
401         try {
402             String JavaDoc category = objectName.getKeyProperty("category");
403             if (category.equalsIgnoreCase("monitor"))
404                 return true;
405             String JavaDoc objectType = objectName.getKeyProperty("type");
406             if (objectType.equals("j2ee-application") ||
407                 objectType.equals("web-module") ||
408                 objectType.equals("ejb-module") ||
409                 objectType.equals("connector-module")) {
410                 String JavaDoc type = (String JavaDoc)MBeanUtil.getAttribute(objectName, "object_type");
411                 if (!type.equalsIgnoreCase("user")) {
412                     return false;
413                 }
414             }
415         } catch (Exception JavaDoc ex) {
416              ex.printStackTrace(); // deliberately ignoring exception
417
}
418         return true;
419     }
420     
421     protected void ensureChildren() {
422         // nothing to do in the default case, override in derived classes.
423
}
424
425     public List JavaDoc getChildren() {
426     ensureChildren();
427     return children;
428     }
429
430     public String JavaDoc toString() {
431     return "[name=" + getNamePath() + " path=" + getPath() + " hid=" + getHighlightID() + "]";
432     }
433
434     public String JavaDoc getNamePath() {
435     if (parent!=null)
436         return parent.getNamePath()+"."+name;
437     else
438         return ""+name;
439     }
440
441     public String JavaDoc getPath() {
442     if (parent!=null)
443         return parent.getPath()+"."+id;
444     else
445         return ""+id;
446     }
447     
448     public IndexTreeNode getNextSibling() {
449     IndexTreeNode result = null;
450     if (parent!=null) {
451         int index=parent.getChildren().indexOf(this);
452         index++;
453         if (index<parent.getChildren().size())
454         result=(IndexTreeNode)parent.getChildren().get(index);
455     }
456     return result;
457     }
458     
459     public void setIsExpanded(boolean expanded) {
460         // if the node was OPENED, now is CLOSED, then set the flag to refresh children again.
461
if (isExpanded == true && expanded == false) {
462             setRefresh(true);
463         }
464         isExpanded = expanded;
465     }
466
467     public IndexTreeNode getParent() {
468     return parent;
469     }
470     
471     public String JavaDoc getHighlightID() {
472     return hid;
473     }
474     
475     public String JavaDoc getHighlightIDPath() {
476     String JavaDoc path = hid;
477     IndexTreeNode p = parent;
478     while (p != null) {
479         path += "."+p.getHighlightID();
480         p = p.parent;
481     }
482     return path;
483     }
484     
485     public String JavaDoc getName() {
486     return Util.getMessage(name);
487     }
488     
489     public String JavaDoc getType() {
490     return type;
491     }
492     
493     public Object JavaDoc getAttribute(String JavaDoc name) {
494         return this.getAttribute(name, true);
495     }
496     
497     public Object JavaDoc getAttribute(String JavaDoc name, boolean lookUpHiearchy) {
498     Object JavaDoc obj = getAttributes().get(name);
499     if (lookUpHiearchy == true && obj == null && parent != null)
500         return parent.getAttribute(name);
501     return obj;
502     }
503     
504     public void setAttribute(String JavaDoc name, Object JavaDoc value) {
505     attributes.put(name,value);
506     }
507     
508     public void setRefresh(boolean refresh) {
509     setAttribute(IndexTreeModel.FIELD_REFRESH, new Boolean JavaDoc(refresh));
510     }
511     
512     public boolean getRefresh() {
513     return ((Boolean JavaDoc)getAttributes().get(IndexTreeModel.FIELD_REFRESH)).booleanValue();
514     }
515     
516     public void setUniqueID(String JavaDoc uniqueID) {
517     setAttribute(IndexTreeModel.FIELD_UNIQUEID, uniqueID);
518     }
519     
520     public String JavaDoc getUniqueID() {
521     return (String JavaDoc)getAttributes().get(IndexTreeModel.FIELD_UNIQUEID);
522     }
523     
524     public String JavaDoc getDisplayName() {
525         // display name is for special case where we want to show a different
526
// name than the node name.
527
String JavaDoc displayName = (String JavaDoc)getAttributes().get(IndexTreeModel.FIELD_DISPLAYNAME);
528     return (displayName == null)?(getName()):(displayName);
529     }
530     
531     public String JavaDoc getLink() {
532     return link;
533     }
534     
535     public void setLink(String JavaDoc link) {
536     this.link = link;
537     }
538     
539     public void removeAllChildren() {
540     children.clear();
541     }
542     
543     protected Map JavaDoc getAttributes() {
544     return attributes;
545     }
546     
547     public String JavaDoc getIconName(boolean expanded) {
548     if (expanded && iconExpanded != null && iconExpanded.equals("")==false)
549         return iconExpanded;
550     if (icon != null)
551         return icon;
552         // return some sort of a default.
553
return "object.gif";
554     }
555     
556     public void setIcon(String JavaDoc icon) {
557     this.icon = icon;
558     }
559     
560     public void setIconExpanded(String JavaDoc iconExpanded) {
561     this.iconExpanded = iconExpanded;
562     }
563     
564     public void setName(String JavaDoc name) {
565     this.name = name;
566     }
567     
568     public int getID() {
569     return id;
570     }
571     
572     public IndexTreeModel getModel() {
573         return model;
574     }
575
576     public boolean closeNode(RequestContext rc) {
577         boolean closed = false;
578         TreeViewStateData data =
579             (TreeViewStateData)rc.getRequest().getSession().getAttribute(
580                 model.getStateDataName());
581         if (data == null)
582             return closed;
583         
584         if (data.isNodeExpanded(getPath())) {
585             closed = true;
586             data.setNodeExpanded(getPath(), false);
587         }
588         return closed;
589     }
590     
591     public boolean openNode(RequestContext rc) {
592         boolean opened = false;
593         TreeViewStateData data =
594             (TreeViewStateData)rc.getRequest().getSession().getAttribute(
595                 model.getStateDataName());
596         if (data == null)
597             return opened;
598
599         IndexTreeNode node = this;
600         while (node != null && node.getParent() != null) {
601             if (data.isNodeExpanded(node.getPath()) == false) {
602                 opened = true;
603                 data.setNodeExpanded(node.getPath(), true);
604             }
605             node = node.getParent();
606         }
607         return opened;
608     }
609     
610     private void setRequestAttribute(HttpServletRequest req, String JavaDoc attrName) {
611         String JavaDoc attr = (String JavaDoc) this.getAttribute(attrName);
612         if (attr == null)
613             req.removeAttribute(attrName);
614         else
615             req.setAttribute(attrName, attr);
616     }
617     
618     private void setRequestAttributes(HttpServletRequest req) {
619         req.setAttribute(EDIT_KEY_VALUE, name);
620         req.setAttribute(OBJECT_NAME, this.getAttribute(OBJECT_NAME, false));
621         req.getSession().setAttribute(EDIT_KEY_VALUE, name);
622         
623         // this is used for the links-page and referenced directly by the JSP
624
req.setAttribute("numberOfChildNodes", new Integer JavaDoc(this.getChildren().size()));
625         setRequestAttribute(req, INSTANCE_NAME);
626         setRequestAttribute(req, CONFIG_NAME);
627         setRequestAttribute(req, CLUSTER_NAME);
628         setRequestAttribute(req, NODEAGENT_NAME);
629         setRequestAttribute(req, APPLICATION_TYPE);
630     }
631     
632     public static IndexTreeNode validateNode(RequestContext rc, IndexTreeNode node) {
633         // Validate the object name of the MBean of the given node. If good,
634
// return the given node. If not, return a parent with a valid
635
// object name.
636
String JavaDoc objectName = (String JavaDoc)node.getAttribute(IndexTreeNode.OBJECT_NAME, false);
637         if (objectName == null) // not holding on to any MBean.
638
return node;
639         boolean valid = MBeanUtil.isValidMBean(objectName);
640         if (valid)
641             return node;
642         IndexTreeNode parent = node.getParent();
643         parent.setRefresh(true); // make the tree view refresh.
644
rc.getRequest().setAttribute("refreshTree", new Boolean JavaDoc("true"));
645         // recursive call.
646
return validateNode(rc, parent);
647     }
648     
649     /**
650      *
651      */

652     public void handleSelection(RequestContext rc)
653             throws ClassNotFoundException JavaDoc, ServletException, IOException JavaDoc {
654     if (Util.isLoggableFINER()) {
655         Util.logFINER("ENTERING IndexTreeNode.handleSelection('"+name+"')");
656     }
657         
658         IndexTreeNode selectedNode = validateNode(rc, this);
659         model.setCurrentNode(selectedNode); // <-- maybe not needed?
660
Util.setSelectedNode(selectedNode);
661         selectedNode.setRequestAttributes(rc.getRequest());
662         
663         String JavaDoc linkPage = selectedNode.getLink();
664
665         if (linkPage != null) {
666         if (linkPage.toLowerCase().endsWith(".html") ||
667             linkPage.toLowerCase().endsWith(".jsp")) {
668         rc.getServletContext().getRequestDispatcher(
669             Util.getLocalizedURL(rc, linkPage)).
670             forward( rc.getRequest(), rc.getResponse());
671         } else {
672         ViewBeanManager mgr = rc.getViewBeanManager();
673         ViewBean targetView = (ViewBean)mgr.getViewBean(linkPage);
674         if ((targetView instanceof DescriptorViewBeanBase)) {
675             DescriptorViewBeanBase viewBean = ((DescriptorViewBeanBase)targetView);
676             viewBean.setAttributes(getAttributes()); // what does this do?
677
}
678         targetView.forwardTo(rc);
679         }
680     } else {
681             throw new FrameworkException(
682         "The link in the Tree node must not be null!");
683         }
684     if (Util.isLoggableFINER()) {
685         Util.logFINER("LEAVING IndexTreeNode.handleSelection('"+name+"')");
686     }
687     }
688
689     public static final String JavaDoc INSTANCE_NAME = "instanceName";
690     public static final String JavaDoc CONFIG_NAME = "configName";
691     public static final String JavaDoc CLUSTER_NAME = "clusterName";
692     public static final String JavaDoc NODEAGENT_NAME = "nodeAgentName";
693     public static final String JavaDoc EDIT_KEY_VALUE = "editKeyValue";
694     public static final String JavaDoc OBJECT_NAME = "objectName";
695     public static final String JavaDoc APPLICATION_TYPE = "ApplicationType";
696         
697     private int id = 0;
698     private IndexTreeNode parent;
699     private String JavaDoc name;
700     private String JavaDoc type;
701     private String JavaDoc hid;
702     private String JavaDoc icon = null;
703     private String JavaDoc iconExpanded = null;
704     private String JavaDoc link = "underConstruction";
705     protected Element JavaDoc dynamicChild = null;
706     
707     protected List JavaDoc children=new ArrayList JavaDoc();
708     private Map JavaDoc attributes=new HashMap JavaDoc();
709     protected IndexTreeModel model;
710     protected boolean isExpanded = false;
711 }
712
Popular Tags