author | vlivanov |
Thu, 18 Jan 2018 02:25:18 +0300 | |
changeset 48596 | 860326263d1f |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
14342
8435a30053c1
7197491: update copyright year to match last edit in jdk8 jdk repository
alanb
parents:
12851
diff
changeset
|
2 |
* Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
package sun.tools.jconsole.inspector; |
|
27 |
||
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
28 |
import java.io.IOException; |
2 | 29 |
import java.util.*; |
30 |
import javax.management.*; |
|
31 |
import javax.swing.*; |
|
32 |
import javax.swing.tree.*; |
|
33 |
import sun.tools.jconsole.JConsole; |
|
34 |
import sun.tools.jconsole.MBeansTab; |
|
12851
3334e1c781d0
7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents:
5506
diff
changeset
|
35 |
import sun.tools.jconsole.Messages; |
2 | 36 |
import sun.tools.jconsole.inspector.XNodeInfo; |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
37 |
import static sun.tools.jconsole.inspector.XNodeInfo.Type; |
2 | 38 |
|
39 |
@SuppressWarnings("serial") |
|
40 |
public class XTree extends JTree { |
|
41 |
||
42 |
private static final List<String> orderedKeyPropertyList = |
|
43 |
new ArrayList<String>(); |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
44 |
|
2 | 45 |
static { |
46 |
String keyPropertyList = |
|
47 |
System.getProperty("com.sun.tools.jconsole.mbeans.keyPropertyList"); |
|
48 |
if (keyPropertyList == null) { |
|
49 |
orderedKeyPropertyList.add("type"); |
|
50 |
orderedKeyPropertyList.add("j2eeType"); |
|
51 |
} else { |
|
52 |
StringTokenizer st = new StringTokenizer(keyPropertyList, ","); |
|
53 |
while (st.hasMoreTokens()) { |
|
54 |
orderedKeyPropertyList.add(st.nextToken()); |
|
55 |
} |
|
56 |
} |
|
57 |
} |
|
58 |
private MBeansTab mbeansTab; |
|
59 |
private Map<String, DefaultMutableTreeNode> nodes = |
|
60 |
new HashMap<String, DefaultMutableTreeNode>(); |
|
61 |
||
62 |
public XTree(MBeansTab mbeansTab) { |
|
63 |
this(new DefaultMutableTreeNode("MBeanTreeRootNode"), mbeansTab); |
|
64 |
} |
|
65 |
||
66 |
public XTree(TreeNode root, MBeansTab mbeansTab) { |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
67 |
super(root, true); |
2 | 68 |
this.mbeansTab = mbeansTab; |
69 |
setRootVisible(false); |
|
70 |
setShowsRootHandles(true); |
|
71 |
ToolTipManager.sharedInstance().registerComponent(this); |
|
72 |
} |
|
73 |
||
74 |
/** |
|
75 |
* This method removes the node from its parent |
|
76 |
*/ |
|
77 |
// Call on EDT |
|
78 |
private synchronized void removeChildNode(DefaultMutableTreeNode child) { |
|
79 |
DefaultTreeModel model = (DefaultTreeModel) getModel(); |
|
80 |
model.removeNodeFromParent(child); |
|
81 |
} |
|
82 |
||
83 |
/** |
|
84 |
* This method adds the child to the specified parent node |
|
85 |
* at specific index. |
|
86 |
*/ |
|
87 |
// Call on EDT |
|
88 |
private synchronized void addChildNode( |
|
89 |
DefaultMutableTreeNode parent, |
|
90 |
DefaultMutableTreeNode child, |
|
91 |
int index) { |
|
92 |
DefaultTreeModel model = (DefaultTreeModel) getModel(); |
|
93 |
model.insertNodeInto(child, parent, index); |
|
94 |
} |
|
95 |
||
96 |
/** |
|
97 |
* This method adds the child to the specified parent node. |
|
98 |
* The index where the child is to be added depends on the |
|
99 |
* child node being Comparable or not. If the child node is |
|
100 |
* not Comparable then it is added at the end, i.e. right |
|
101 |
* after the current parent's children. |
|
102 |
*/ |
|
103 |
// Call on EDT |
|
104 |
private synchronized void addChildNode( |
|
105 |
DefaultMutableTreeNode parent, DefaultMutableTreeNode child) { |
|
106 |
int childCount = parent.getChildCount(); |
|
107 |
if (childCount == 0) { |
|
108 |
addChildNode(parent, child, 0); |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
109 |
return; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
110 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
111 |
if (child instanceof ComparableDefaultMutableTreeNode) { |
2 | 112 |
ComparableDefaultMutableTreeNode comparableChild = |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
113 |
(ComparableDefaultMutableTreeNode) child; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
114 |
for (int i = childCount - 1; i >= 0; i--) { |
2 | 115 |
DefaultMutableTreeNode brother = |
116 |
(DefaultMutableTreeNode) parent.getChildAt(i); |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
117 |
// expr1: child node must be inserted after metadata nodes |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
118 |
// - OR - |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
119 |
// expr2: "child >= brother" |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
120 |
if ((i <= 2 && isMetadataNode(brother)) || |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
121 |
comparableChild.compareTo(brother) >= 0) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
122 |
addChildNode(parent, child, i + 1); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
123 |
return; |
2 | 124 |
} |
125 |
} |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
126 |
// "child < all brothers", add at the beginning |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
127 |
addChildNode(parent, child, 0); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
128 |
return; |
2 | 129 |
} |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
130 |
// "child not comparable", add at the end |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
131 |
addChildNode(parent, child, childCount); |
2 | 132 |
} |
133 |
||
134 |
/** |
|
135 |
* This method removes all the displayed nodes from the tree, |
|
136 |
* but does not affect actual MBeanServer contents. |
|
137 |
*/ |
|
138 |
// Call on EDT |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
139 |
@Override |
2 | 140 |
public synchronized void removeAll() { |
141 |
DefaultTreeModel model = (DefaultTreeModel) getModel(); |
|
142 |
DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot(); |
|
143 |
root.removeAllChildren(); |
|
144 |
model.nodeStructureChanged(root); |
|
145 |
nodes.clear(); |
|
146 |
} |
|
147 |
||
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
148 |
// Call on EDT |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
149 |
public synchronized void removeMBeanFromView(ObjectName mbean) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
150 |
// We assume here that MBeans are removed one by one (on MBean |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
151 |
// unregistered notification). Deletes the tree node associated |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
152 |
// with the given MBean and recursively all the node parents |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
153 |
// which are leaves and non XMBean. |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
154 |
// |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
155 |
DefaultMutableTreeNode node = null; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
156 |
Dn dn = new Dn(mbean); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
157 |
if (dn.getTokenCount() > 0) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
158 |
DefaultTreeModel model = (DefaultTreeModel) getModel(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
159 |
Token token = dn.getToken(0); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
160 |
String hashKey = dn.getHashKey(token); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
161 |
node = nodes.get(hashKey); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
162 |
if ((node != null) && (!node.isRoot())) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
163 |
if (hasNonMetadataNodes(node)) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
164 |
removeMetadataNodes(node); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
165 |
String label = token.getValue(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
166 |
XNodeInfo userObject = new XNodeInfo( |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
167 |
Type.NONMBEAN, label, |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
168 |
label, token.getTokenValue()); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
169 |
changeNodeValue(node, userObject); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
170 |
} else { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
171 |
DefaultMutableTreeNode parent = |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
172 |
(DefaultMutableTreeNode) node.getParent(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
173 |
model.removeNodeFromParent(node); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
174 |
nodes.remove(hashKey); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
175 |
removeParentFromView(dn, 1, parent); |
2 | 176 |
} |
177 |
} |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
178 |
} |
2 | 179 |
} |
180 |
||
181 |
/** |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
182 |
* Returns true if any of the children nodes is a non MBean metadata node. |
2 | 183 |
*/ |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
184 |
private boolean hasNonMetadataNodes(DefaultMutableTreeNode node) { |
12851
3334e1c781d0
7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents:
5506
diff
changeset
|
185 |
for (Enumeration<?> e = node.children(); e.hasMoreElements();) { |
2 | 186 |
DefaultMutableTreeNode n = (DefaultMutableTreeNode) e.nextElement(); |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
187 |
Object uo = n.getUserObject(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
188 |
if (uo instanceof XNodeInfo) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
189 |
switch (((XNodeInfo) uo).getType()) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
190 |
case ATTRIBUTES: |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
191 |
case NOTIFICATIONS: |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
192 |
case OPERATIONS: |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
193 |
break; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
194 |
default: |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
195 |
return true; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
196 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
197 |
} else { |
2 | 198 |
return true; |
199 |
} |
|
200 |
} |
|
201 |
return false; |
|
202 |
} |
|
203 |
||
204 |
/** |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
205 |
* Returns true if any of the children nodes is an MBean metadata node. |
2 | 206 |
*/ |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
207 |
public boolean hasMetadataNodes(DefaultMutableTreeNode node) { |
12851
3334e1c781d0
7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents:
5506
diff
changeset
|
208 |
for (Enumeration<?> e = node.children(); e.hasMoreElements();) { |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
209 |
DefaultMutableTreeNode n = (DefaultMutableTreeNode) e.nextElement(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
210 |
Object uo = n.getUserObject(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
211 |
if (uo instanceof XNodeInfo) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
212 |
switch (((XNodeInfo) uo).getType()) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
213 |
case ATTRIBUTES: |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
214 |
case NOTIFICATIONS: |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
215 |
case OPERATIONS: |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
216 |
return true; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
217 |
default: |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
218 |
break; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
219 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
220 |
} else { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
221 |
return false; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
222 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
223 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
224 |
return false; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
225 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
226 |
|
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
227 |
/** |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
228 |
* Returns true if the given node is an MBean metadata node. |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
229 |
*/ |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
230 |
public boolean isMetadataNode(DefaultMutableTreeNode node) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
231 |
Object uo = node.getUserObject(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
232 |
if (uo instanceof XNodeInfo) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
233 |
switch (((XNodeInfo) uo).getType()) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
234 |
case ATTRIBUTES: |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
235 |
case NOTIFICATIONS: |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
236 |
case OPERATIONS: |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
237 |
return true; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
238 |
default: |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
239 |
return false; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
240 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
241 |
} else { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
242 |
return false; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
243 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
244 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
245 |
|
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
246 |
/** |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
247 |
* Remove the metadata nodes associated with a given MBean node. |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
248 |
*/ |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
249 |
// Call on EDT |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
250 |
private void removeMetadataNodes(DefaultMutableTreeNode node) { |
2 | 251 |
Set<DefaultMutableTreeNode> metadataNodes = |
252 |
new HashSet<DefaultMutableTreeNode>(); |
|
253 |
DefaultTreeModel model = (DefaultTreeModel) getModel(); |
|
12851
3334e1c781d0
7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents:
5506
diff
changeset
|
254 |
for (Enumeration<?> e = node.children(); e.hasMoreElements();) { |
2 | 255 |
DefaultMutableTreeNode n = (DefaultMutableTreeNode) e.nextElement(); |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
256 |
Object uo = n.getUserObject(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
257 |
if (uo instanceof XNodeInfo) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
258 |
switch (((XNodeInfo) uo).getType()) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
259 |
case ATTRIBUTES: |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
260 |
case NOTIFICATIONS: |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
261 |
case OPERATIONS: |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
262 |
metadataNodes.add(n); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
263 |
break; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
264 |
default: |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
265 |
break; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
266 |
} |
2 | 267 |
} |
268 |
} |
|
269 |
for (DefaultMutableTreeNode n : metadataNodes) { |
|
270 |
model.removeNodeFromParent(n); |
|
271 |
} |
|
272 |
} |
|
273 |
||
274 |
/** |
|
275 |
* Removes only the parent nodes which are non MBean and leaf. |
|
276 |
* This method assumes the child nodes have been removed before. |
|
277 |
*/ |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
278 |
// Call on EDT |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
279 |
private DefaultMutableTreeNode removeParentFromView( |
2 | 280 |
Dn dn, int index, DefaultMutableTreeNode node) { |
281 |
if ((!node.isRoot()) && node.isLeaf() && |
|
282 |
(!(((XNodeInfo) node.getUserObject()).getType().equals(Type.MBEAN)))) { |
|
283 |
DefaultMutableTreeNode parent = |
|
284 |
(DefaultMutableTreeNode) node.getParent(); |
|
285 |
removeChildNode(node); |
|
286 |
String hashKey = dn.getHashKey(dn.getToken(index)); |
|
287 |
nodes.remove(hashKey); |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
288 |
removeParentFromView(dn, index + 1, parent); |
2 | 289 |
} |
290 |
return node; |
|
291 |
} |
|
292 |
||
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
293 |
// Call on EDT |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
294 |
public synchronized void addMBeansToView(Set<ObjectName> mbeans) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
295 |
Set<Dn> dns = new TreeSet<Dn>(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
296 |
for (ObjectName mbean : mbeans) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
297 |
Dn dn = new Dn(mbean); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
298 |
dns.add(dn); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
299 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
300 |
for (Dn dn : dns) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
301 |
ObjectName mbean = dn.getObjectName(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
302 |
XMBean xmbean = new XMBean(mbean, mbeansTab); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
303 |
addMBeanToView(mbean, xmbean, dn); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
304 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
305 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
306 |
|
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
307 |
// Call on EDT |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
308 |
public synchronized void addMBeanToView(ObjectName mbean) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
309 |
// Build XMBean for the given MBean |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
310 |
// |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
311 |
XMBean xmbean = new XMBean(mbean, mbeansTab); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
312 |
// Build Dn for the given MBean |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
313 |
// |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
314 |
Dn dn = new Dn(mbean); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
315 |
// Add the new nodes to the MBean tree from leaf to root |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
316 |
// |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
317 |
addMBeanToView(mbean, xmbean, dn); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
318 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
319 |
|
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
320 |
// Call on EDT |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
321 |
private synchronized void addMBeanToView( |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
322 |
ObjectName mbean, XMBean xmbean, Dn dn) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
323 |
|
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
324 |
DefaultMutableTreeNode childNode = null; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
325 |
DefaultMutableTreeNode parentNode = null; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
326 |
|
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
327 |
// Add the node or replace its user object if already added |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
328 |
// |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
329 |
Token token = dn.getToken(0); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
330 |
String hashKey = dn.getHashKey(token); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
331 |
if (nodes.containsKey(hashKey)) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
332 |
// Found existing node previously created when adding another node |
2 | 333 |
// |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
334 |
childNode = nodes.get(hashKey); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
335 |
// Replace user object to reflect that this node is an MBean |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
336 |
// |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
337 |
Object data = createNodeValue(xmbean, token); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
338 |
String label = data.toString(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
339 |
XNodeInfo userObject = |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
340 |
new XNodeInfo(Type.MBEAN, data, label, mbean.toString()); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
341 |
changeNodeValue(childNode, userObject); |
2 | 342 |
return; |
343 |
} |
|
344 |
||
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
345 |
// Create new leaf node |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
346 |
// |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
347 |
childNode = createDnNode(dn, token, xmbean); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
348 |
nodes.put(hashKey, childNode); |
2 | 349 |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
350 |
// Add intermediate non MBean nodes |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
351 |
// |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
352 |
for (int i = 1; i < dn.getTokenCount(); i++) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
353 |
token = dn.getToken(i); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
354 |
hashKey = dn.getHashKey(token); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
355 |
if (nodes.containsKey(hashKey)) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
356 |
// Intermediate node already present, add new node as child |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
357 |
// |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
358 |
parentNode = nodes.get(hashKey); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
359 |
addChildNode(parentNode, childNode); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
360 |
return; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
361 |
} else { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
362 |
// Create new intermediate node |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
363 |
// |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
364 |
if ("domain".equals(token.getTokenType())) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
365 |
parentNode = createDomainNode(dn, token); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
366 |
DefaultMutableTreeNode root = |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
367 |
(DefaultMutableTreeNode) getModel().getRoot(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
368 |
addChildNode(root, parentNode); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
369 |
} else { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
370 |
parentNode = createSubDnNode(dn, token); |
2 | 371 |
} |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
372 |
nodes.put(hashKey, parentNode); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
373 |
addChildNode(parentNode, childNode); |
2 | 374 |
} |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
375 |
childNode = parentNode; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
376 |
} |
2 | 377 |
} |
378 |
||
379 |
// Call on EDT |
|
380 |
private synchronized void changeNodeValue( |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
381 |
DefaultMutableTreeNode node, XNodeInfo nodeValue) { |
2 | 382 |
if (node instanceof ComparableDefaultMutableTreeNode) { |
383 |
// should it stay at the same place? |
|
384 |
DefaultMutableTreeNode clone = |
|
385 |
(DefaultMutableTreeNode) node.clone(); |
|
386 |
clone.setUserObject(nodeValue); |
|
387 |
if (((ComparableDefaultMutableTreeNode) node).compareTo(clone) == 0) { |
|
388 |
// the order in the tree didn't change |
|
389 |
node.setUserObject(nodeValue); |
|
390 |
DefaultTreeModel model = (DefaultTreeModel) getModel(); |
|
391 |
model.nodeChanged(node); |
|
392 |
} else { |
|
393 |
// delete the node and re-order it in case the |
|
394 |
// node value modifies the order in the tree |
|
395 |
DefaultMutableTreeNode parent = |
|
396 |
(DefaultMutableTreeNode) node.getParent(); |
|
397 |
removeChildNode(node); |
|
398 |
node.setUserObject(nodeValue); |
|
399 |
addChildNode(parent, node); |
|
400 |
} |
|
401 |
} else { |
|
402 |
// not comparable stays at the same place |
|
403 |
node.setUserObject(nodeValue); |
|
404 |
DefaultTreeModel model = (DefaultTreeModel) getModel(); |
|
405 |
model.nodeChanged(node); |
|
406 |
} |
|
407 |
// Load the MBean metadata if type is MBEAN |
|
408 |
if (nodeValue.getType().equals(Type.MBEAN)) { |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
409 |
removeMetadataNodes(node); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
410 |
TreeNode[] treeNodes = node.getPath(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
411 |
TreePath path = new TreePath(treeNodes); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
412 |
if (isExpanded(path)) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
413 |
addMetadataNodes(node); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
414 |
} |
2 | 415 |
} |
416 |
// Clear the current selection and set it |
|
417 |
// again so valueChanged() gets called |
|
418 |
if (node == getLastSelectedPathComponent()) { |
|
419 |
TreePath selectionPath = getSelectionPath(); |
|
420 |
clearSelection(); |
|
421 |
setSelectionPath(selectionPath); |
|
422 |
} |
|
423 |
} |
|
424 |
||
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
425 |
/** |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
426 |
* Creates the domain node. |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
427 |
*/ |
2 | 428 |
private DefaultMutableTreeNode createDomainNode(Dn dn, Token token) { |
429 |
DefaultMutableTreeNode node = new ComparableDefaultMutableTreeNode(); |
|
430 |
String label = dn.getDomain(); |
|
431 |
XNodeInfo userObject = |
|
432 |
new XNodeInfo(Type.NONMBEAN, label, label, label); |
|
433 |
node.setUserObject(userObject); |
|
434 |
return node; |
|
435 |
} |
|
436 |
||
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
437 |
/** |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
438 |
* Creates the node corresponding to the whole Dn, i.e. an MBean. |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
439 |
*/ |
2 | 440 |
private DefaultMutableTreeNode createDnNode( |
441 |
Dn dn, Token token, XMBean xmbean) { |
|
442 |
DefaultMutableTreeNode node = new ComparableDefaultMutableTreeNode(); |
|
443 |
Object data = createNodeValue(xmbean, token); |
|
444 |
String label = data.toString(); |
|
445 |
XNodeInfo userObject = new XNodeInfo(Type.MBEAN, data, label, |
|
446 |
xmbean.getObjectName().toString()); |
|
447 |
node.setUserObject(userObject); |
|
448 |
return node; |
|
449 |
} |
|
450 |
||
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
451 |
/** |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
452 |
* Creates the node corresponding to a subDn, i.e. a non-MBean |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
453 |
* intermediate node. |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
454 |
*/ |
2 | 455 |
private DefaultMutableTreeNode createSubDnNode(Dn dn, Token token) { |
456 |
DefaultMutableTreeNode node = new ComparableDefaultMutableTreeNode(); |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
457 |
String label = isKeyValueView() ? token.getTokenValue() : token.getValue(); |
2 | 458 |
XNodeInfo userObject = |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
459 |
new XNodeInfo(Type.NONMBEAN, label, label, token.getTokenValue()); |
2 | 460 |
node.setUserObject(userObject); |
461 |
return node; |
|
462 |
} |
|
463 |
||
464 |
private Object createNodeValue(XMBean xmbean, Token token) { |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
465 |
String label = isKeyValueView() ? token.getTokenValue() : token.getValue(); |
2 | 466 |
xmbean.setText(label); |
467 |
return xmbean; |
|
468 |
} |
|
469 |
||
470 |
/** |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
471 |
* Parses the MBean ObjectName comma-separated properties string and puts |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
472 |
* the individual key/value pairs into the map. Key order in the properties |
2 | 473 |
* string is preserved by the map. |
474 |
*/ |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
475 |
private static Map<String, String> extractKeyValuePairs( |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
476 |
String props, ObjectName mbean) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
477 |
Map<String, String> map = new LinkedHashMap<String, String>(); |
24685
215fa91e1b4c
8044461: Cleanup new Boolean and single character strings
rriggs
parents:
14342
diff
changeset
|
478 |
int eq = props.indexOf('='); |
2 | 479 |
while (eq != -1) { |
480 |
String key = props.substring(0, eq); |
|
481 |
String value = mbean.getKeyProperty(key); |
|
482 |
map.put(key, value); |
|
483 |
props = props.substring(key.length() + 1 + value.length()); |
|
484 |
if (props.startsWith(",")) { |
|
485 |
props = props.substring(1); |
|
486 |
} |
|
24685
215fa91e1b4c
8044461: Cleanup new Boolean and single character strings
rriggs
parents:
14342
diff
changeset
|
487 |
eq = props.indexOf('='); |
2 | 488 |
} |
489 |
return map; |
|
490 |
} |
|
491 |
||
492 |
/** |
|
493 |
* Returns the ordered key property list that will be used to build the |
|
494 |
* MBean tree. If the "com.sun.tools.jconsole.mbeans.keyPropertyList" system |
|
495 |
* property is not specified, then the ordered key property list used |
|
496 |
* to build the MBean tree will be the one returned by the method |
|
497 |
* ObjectName.getKeyPropertyListString() with "type" as first key, |
|
498 |
* and "j2eeType" as second key, if present. If any of the keys specified |
|
499 |
* in the comma-separated key property list does not apply to the given |
|
500 |
* MBean then it will be discarded. |
|
501 |
*/ |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
502 |
private static String getKeyPropertyListString(ObjectName mbean) { |
2 | 503 |
String props = mbean.getKeyPropertyListString(); |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
504 |
Map<String, String> map = extractKeyValuePairs(props, mbean); |
2 | 505 |
StringBuilder sb = new StringBuilder(); |
506 |
// Add the key/value pairs to the buffer following the |
|
507 |
// key order defined by the "orderedKeyPropertyList" |
|
508 |
for (String key : orderedKeyPropertyList) { |
|
509 |
if (map.containsKey(key)) { |
|
27957
24b4e6082f19
8055723: Replace concat String to append in StringBuilder parameters (dev)
weijun
parents:
25859
diff
changeset
|
510 |
sb.append(key).append('=').append(map.get(key)).append(','); |
2 | 511 |
map.remove(key); |
512 |
} |
|
513 |
} |
|
514 |
// Add the remaining key/value pairs to the buffer |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
515 |
for (Map.Entry<String, String> entry : map.entrySet()) { |
27957
24b4e6082f19
8055723: Replace concat String to append in StringBuilder parameters (dev)
weijun
parents:
25859
diff
changeset
|
516 |
sb.append(entry.getKey()).append('=').append(entry.getValue()).append(','); |
2 | 517 |
} |
518 |
String orderedKeyPropertyListString = sb.toString(); |
|
519 |
orderedKeyPropertyListString = orderedKeyPropertyListString.substring( |
|
520 |
0, orderedKeyPropertyListString.length() - 1); |
|
521 |
return orderedKeyPropertyListString; |
|
522 |
} |
|
523 |
||
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
524 |
// Call on EDT |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
525 |
public void addMetadataNodes(DefaultMutableTreeNode node) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
526 |
XMBean mbean = (XMBean) ((XNodeInfo) node.getUserObject()).getData(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
527 |
DefaultTreeModel model = (DefaultTreeModel) getModel(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
528 |
MBeanInfoNodesSwingWorker sw = |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
529 |
new MBeanInfoNodesSwingWorker(model, node, mbean); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
530 |
if (sw != null) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
531 |
sw.execute(); |
2 | 532 |
} |
533 |
} |
|
534 |
||
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
535 |
private static class MBeanInfoNodesSwingWorker |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
536 |
extends SwingWorker<Object[], Void> { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
537 |
|
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
538 |
private final DefaultTreeModel model; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
539 |
private final DefaultMutableTreeNode node; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
540 |
private final XMBean mbean; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
541 |
|
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
542 |
public MBeanInfoNodesSwingWorker( |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
543 |
DefaultTreeModel model, |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
544 |
DefaultMutableTreeNode node, |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
545 |
XMBean mbean) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
546 |
this.model = model; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
547 |
this.node = node; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
548 |
this.mbean = mbean; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
549 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
550 |
|
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
551 |
@Override |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
552 |
public Object[] doInBackground() throws InstanceNotFoundException, |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
553 |
IntrospectionException, ReflectionException, IOException { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
554 |
Object result[] = new Object[2]; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
555 |
// Retrieve MBeanInfo for this MBean |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
556 |
result[0] = mbean.getMBeanInfo(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
557 |
// Check if this MBean is a notification emitter |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
558 |
result[1] = mbean.isBroadcaster(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
559 |
return result; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
560 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
561 |
|
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
562 |
@Override |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
563 |
protected void done() { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
564 |
try { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
565 |
Object result[] = get(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
566 |
MBeanInfo mbeanInfo = (MBeanInfo) result[0]; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
567 |
Boolean isBroadcaster = (Boolean) result[1]; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
568 |
if (mbeanInfo != null) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
569 |
addMBeanInfoNodes(model, node, mbean, mbeanInfo, isBroadcaster); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
570 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
571 |
} catch (Exception e) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
572 |
Throwable t = Utils.getActualException(e); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
573 |
if (JConsole.isDebug()) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
574 |
t.printStackTrace(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
575 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
576 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
577 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
578 |
|
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
579 |
// Call on EDT |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
580 |
private void addMBeanInfoNodes( |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
581 |
DefaultTreeModel tree, DefaultMutableTreeNode node, |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
582 |
XMBean mbean, MBeanInfo mbeanInfo, Boolean isBroadcaster) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
583 |
MBeanAttributeInfo[] ai = mbeanInfo.getAttributes(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
584 |
MBeanOperationInfo[] oi = mbeanInfo.getOperations(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
585 |
MBeanNotificationInfo[] ni = mbeanInfo.getNotifications(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
586 |
|
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
587 |
// Insert the Attributes/Operations/Notifications metadata nodes as |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
588 |
// the three first children of this MBean node. This is only useful |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
589 |
// when this MBean node denotes an MBean but it's not a leaf in the |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
590 |
// MBean tree |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
591 |
// |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
592 |
int childIndex = 0; |
2 | 593 |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
594 |
// MBeanAttributeInfo node |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
595 |
// |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
596 |
if (ai != null && ai.length > 0) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
597 |
DefaultMutableTreeNode attributes = new DefaultMutableTreeNode(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
598 |
XNodeInfo attributesUO = new XNodeInfo(Type.ATTRIBUTES, mbean, |
12851
3334e1c781d0
7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents:
5506
diff
changeset
|
599 |
Messages.ATTRIBUTES, null); |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
600 |
attributes.setUserObject(attributesUO); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
601 |
node.insert(attributes, childIndex++); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
602 |
for (MBeanAttributeInfo mbai : ai) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
603 |
DefaultMutableTreeNode attribute = new DefaultMutableTreeNode(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
604 |
XNodeInfo attributeUO = new XNodeInfo(Type.ATTRIBUTE, |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
605 |
new Object[]{mbean, mbai}, mbai.getName(), null); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
606 |
attribute.setUserObject(attributeUO); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
607 |
attribute.setAllowsChildren(false); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
608 |
attributes.add(attribute); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
609 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
610 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
611 |
// MBeanOperationInfo node |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
612 |
// |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
613 |
if (oi != null && oi.length > 0) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
614 |
DefaultMutableTreeNode operations = new DefaultMutableTreeNode(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
615 |
XNodeInfo operationsUO = new XNodeInfo(Type.OPERATIONS, mbean, |
12851
3334e1c781d0
7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents:
5506
diff
changeset
|
616 |
Messages.OPERATIONS, null); |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
617 |
operations.setUserObject(operationsUO); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
618 |
node.insert(operations, childIndex++); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
619 |
for (MBeanOperationInfo mboi : oi) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
620 |
// Compute the operation's tool tip text: |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
621 |
// "operationname(param1type,param2type,...)" |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
622 |
// |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
623 |
StringBuilder sb = new StringBuilder(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
624 |
for (MBeanParameterInfo mbpi : mboi.getSignature()) { |
27957
24b4e6082f19
8055723: Replace concat String to append in StringBuilder parameters (dev)
weijun
parents:
25859
diff
changeset
|
625 |
sb.append(mbpi.getType()).append(','); |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
626 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
627 |
String signature = sb.toString(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
628 |
if (signature.length() > 0) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
629 |
// Remove the trailing ',' |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
630 |
// |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
631 |
signature = signature.substring(0, signature.length() - 1); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
632 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
633 |
String toolTipText = mboi.getName() + "(" + signature + ")"; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
634 |
// Create operation node |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
635 |
// |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
636 |
DefaultMutableTreeNode operation = new DefaultMutableTreeNode(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
637 |
XNodeInfo operationUO = new XNodeInfo(Type.OPERATION, |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
638 |
new Object[]{mbean, mboi}, mboi.getName(), toolTipText); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
639 |
operation.setUserObject(operationUO); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
640 |
operation.setAllowsChildren(false); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
641 |
operations.add(operation); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
642 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
643 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
644 |
// MBeanNotificationInfo node |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
645 |
// |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
646 |
if (isBroadcaster != null && isBroadcaster.booleanValue()) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
647 |
DefaultMutableTreeNode notifications = new DefaultMutableTreeNode(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
648 |
XNodeInfo notificationsUO = new XNodeInfo(Type.NOTIFICATIONS, mbean, |
12851
3334e1c781d0
7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents:
5506
diff
changeset
|
649 |
Messages.NOTIFICATIONS, null); |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
650 |
notifications.setUserObject(notificationsUO); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
651 |
node.insert(notifications, childIndex++); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
652 |
if (ni != null && ni.length > 0) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
653 |
for (MBeanNotificationInfo mbni : ni) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
654 |
DefaultMutableTreeNode notification = |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
655 |
new DefaultMutableTreeNode(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
656 |
XNodeInfo notificationUO = new XNodeInfo(Type.NOTIFICATION, |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
657 |
mbni, mbni.getName(), null); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
658 |
notification.setUserObject(notificationUO); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
659 |
notification.setAllowsChildren(false); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
660 |
notifications.add(notification); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
661 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
662 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
663 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
664 |
// Update tree model |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
665 |
// |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
666 |
model.reload(node); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
667 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
668 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
669 |
// |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
670 |
// Tree preferences |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
671 |
// |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
672 |
private static boolean treeView; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
673 |
private static boolean treeViewInit = false; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
674 |
|
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
675 |
private static boolean isTreeView() { |
2 | 676 |
if (!treeViewInit) { |
677 |
treeView = getTreeViewValue(); |
|
678 |
treeViewInit = true; |
|
679 |
} |
|
680 |
return treeView; |
|
681 |
} |
|
682 |
||
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
683 |
private static boolean getTreeViewValue() { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
684 |
String tv = System.getProperty("treeView"); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
685 |
return ((tv == null) ? true : !(tv.equals("false"))); |
2 | 686 |
} |
687 |
// |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
688 |
// MBean key-value preferences |
2 | 689 |
// |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
690 |
private boolean keyValueView = Boolean.getBoolean("keyValueView"); |
2 | 691 |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
692 |
private boolean isKeyValueView() { |
2 | 693 |
return keyValueView; |
694 |
} |
|
695 |
||
696 |
// |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
697 |
// Utility classes |
2 | 698 |
// |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
699 |
private static class ComparableDefaultMutableTreeNode |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
700 |
extends DefaultMutableTreeNode |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
701 |
implements Comparable<DefaultMutableTreeNode> { |
2 | 702 |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
703 |
public int compareTo(DefaultMutableTreeNode node) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
704 |
return (this.toString().compareTo(node.toString())); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
705 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
706 |
} |
2 | 707 |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
708 |
private static class Dn implements Comparable<Dn> { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
709 |
|
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
710 |
private ObjectName mbean; |
2 | 711 |
private String domain; |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
712 |
private String keyPropertyList; |
2 | 713 |
private String hashDn; |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
714 |
private List<Token> tokens = new ArrayList<Token>(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
715 |
|
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
716 |
public Dn(ObjectName mbean) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
717 |
this.mbean = mbean; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
718 |
this.domain = mbean.getDomain(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
719 |
this.keyPropertyList = getKeyPropertyListString(mbean); |
2 | 720 |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
721 |
if (isTreeView()) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
722 |
// Tree view |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
723 |
Map<String, String> map = |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
724 |
extractKeyValuePairs(keyPropertyList, mbean); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
725 |
for (Map.Entry<String, String> entry : map.entrySet()) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
726 |
tokens.add(new Token("key", entry.getKey() + "=" + entry.getValue())); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
727 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
728 |
} else { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
729 |
// Flat view |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
730 |
tokens.add(new Token("key", "properties=" + keyPropertyList)); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
731 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
732 |
|
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
733 |
// Add the domain as the first token in the Dn |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
734 |
tokens.add(0, new Token("domain", "domain=" + domain)); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
735 |
|
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
736 |
// Reverse the Dn (from leaf to root) |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
737 |
Collections.reverse(tokens); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
738 |
|
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
739 |
// Compute hash for Dn |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
740 |
computeHashDn(); |
2 | 741 |
} |
742 |
||
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
743 |
public ObjectName getObjectName() { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
744 |
return mbean; |
2 | 745 |
} |
746 |
||
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
747 |
public String getDomain() { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
748 |
return domain; |
2 | 749 |
} |
750 |
||
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
751 |
public String getKeyPropertyList() { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
752 |
return keyPropertyList; |
2 | 753 |
} |
754 |
||
755 |
public Token getToken(int index) { |
|
756 |
return tokens.get(index); |
|
757 |
} |
|
758 |
||
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
759 |
public int getTokenCount() { |
2 | 760 |
return tokens.size(); |
761 |
} |
|
762 |
||
763 |
public String getHashDn() { |
|
764 |
return hashDn; |
|
765 |
} |
|
766 |
||
767 |
public String getHashKey(Token token) { |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
768 |
final int begin = hashDn.indexOf(token.getTokenValue()); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
769 |
return hashDn.substring(begin, hashDn.length()); |
2 | 770 |
} |
771 |
||
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
772 |
private void computeHashDn() { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
773 |
if (tokens.isEmpty()) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
774 |
return; |
2 | 775 |
} |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
776 |
final StringBuilder hdn = new StringBuilder(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
777 |
for (int i = 0; i < tokens.size(); i++) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
778 |
hdn.append(tokens.get(i).getTokenValue()); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
779 |
hdn.append(","); |
2 | 780 |
} |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
781 |
hashDn = hdn.substring(0, hdn.length() - 1); |
2 | 782 |
} |
783 |
||
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
784 |
@Override |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
785 |
public String toString() { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
786 |
return domain + ":" + keyPropertyList; |
2 | 787 |
} |
788 |
||
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
789 |
public int compareTo(Dn dn) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
790 |
return this.toString().compareTo(dn.toString()); |
2 | 791 |
} |
792 |
} |
|
793 |
||
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
794 |
private static class Token { |
2 | 795 |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
796 |
private String tokenType; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
797 |
private String tokenValue; |
2 | 798 |
private String key; |
799 |
private String value; |
|
800 |
||
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
801 |
public Token(String tokenType, String tokenValue) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
802 |
this.tokenType = tokenType; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
803 |
this.tokenValue = tokenValue; |
2 | 804 |
buildKeyValue(); |
805 |
} |
|
806 |
||
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
807 |
public String getTokenType() { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
808 |
return tokenType; |
2 | 809 |
} |
810 |
||
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
811 |
public String getTokenValue() { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
812 |
return tokenValue; |
2 | 813 |
} |
814 |
||
815 |
public String getKey() { |
|
816 |
return key; |
|
817 |
} |
|
818 |
||
819 |
public String getValue() { |
|
820 |
return value; |
|
821 |
} |
|
822 |
||
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
823 |
private void buildKeyValue() { |
24685
215fa91e1b4c
8044461: Cleanup new Boolean and single character strings
rriggs
parents:
14342
diff
changeset
|
824 |
int index = tokenValue.indexOf('='); |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
825 |
if (index < 0) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
826 |
key = tokenValue; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
827 |
value = tokenValue; |
2 | 828 |
} else { |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
829 |
key = tokenValue.substring(0, index); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
830 |
value = tokenValue.substring(index + 1, tokenValue.length()); |
2 | 831 |
} |
832 |
} |
|
833 |
} |
|
834 |
} |