mc4j-cvs Mailing List for MC4J JMX Console (Page 30)
Brought to you by:
ghinkl
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
(7) |
Apr
(135) |
May
(32) |
Jun
(34) |
Jul
|
Aug
|
Sep
(7) |
Oct
(139) |
Nov
(11) |
Dec
(5) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(34) |
Feb
(1) |
Mar
(12) |
Apr
|
May
(87) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(27) |
Nov
(49) |
Dec
(13) |
2006 |
Jan
|
Feb
|
Mar
|
Apr
(252) |
May
(16) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(3) |
Oct
|
Nov
(1) |
Dec
|
2009 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
(2) |
Jul
(15) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
(6) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
(1) |
Nov
|
Dec
|
From: Greg H. <gh...@us...> - 2004-06-10 18:15:19
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/jre15/components In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7594/src/org/mc4j/jre15/components Modified Files: DeadlockDetectionComponent.java MemoryUsageAreaChartComponent.java MemoryUsageComponent.java MemoryUsageLineChartComponent.java MemoryUsagePieChartComponent.java ThreadMBeanThreadBrowserComponent.java Log Message: Updated for the new interfaces of 1.5 beta 2. Will no longer work against beta 1! Index: MemoryUsageAreaChartComponent.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/jre15/components/MemoryUsageAreaChartComponent.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MemoryUsageAreaChartComponent.java 26 May 2004 03:11:02 -0000 1.1 --- MemoryUsageAreaChartComponent.java 10 Jun 2004 18:15:07 -0000 1.2 *************** *** 50,53 **** --- 50,54 ---- import javax.management.MBeanServer; import javax.management.ObjectName; + import javax.management.openmbean.CompositeData; import javax.swing.border.LineBorder; *************** *** 160,164 **** ObjectName objectName = beanNode.getObjectName(); ! MemoryUsage usage = (MemoryUsage) this.server.getAttribute(objectName, "Usage"); String name = (String) ((AttributeNode)beanNode.getAttributeNodeMap().get("Name")).getValue(); --- 161,165 ---- ObjectName objectName = beanNode.getObjectName(); ! MemoryUsage usage = MemoryUsage.from((CompositeData) this.server.getAttribute(objectName, "Usage")); String name = (String) ((AttributeNode)beanNode.getAttributeNodeMap().get("Name")).getValue(); Index: ThreadMBeanThreadBrowserComponent.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/jre15/components/ThreadMBeanThreadBrowserComponent.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ThreadMBeanThreadBrowserComponent.java 30 Apr 2004 13:26:13 -0000 1.2 --- ThreadMBeanThreadBrowserComponent.java 10 Jun 2004 18:15:07 -0000 1.3 *************** *** 21,25 **** import org.openide.ErrorManager; - import org.mc4j.console.Refreshable; import org.mc4j.console.dashboard.Dashboard; import org.mc4j.console.dashboard.DashboardComponent; --- 21,24 ---- *************** *** 29,34 **** import java.lang.management.ManagementFactory; import java.lang.management.ThreadInfo; ! import java.lang.management.ThreadMBean; ! import java.lang.management.ThreadState; import java.util.Arrays; import java.util.HashMap; --- 28,32 ---- import java.lang.management.ManagementFactory; import java.lang.management.ThreadInfo; ! import java.lang.management.ThreadMXBean; import java.util.Arrays; import java.util.HashMap; *************** *** 42,45 **** --- 40,44 ---- import javax.management.MalformedObjectNameException; import javax.management.ObjectName; + import javax.management.openmbean.CompositeData; import javax.swing.Icon; import javax.swing.ImageIcon; *************** *** 58,64 **** * @version $Revision$($Author$ / $Date$) */ ! public class ThreadMBeanThreadBrowserComponent extends JPanel implements DashboardComponent, Refreshable { ! protected ThreadMBean threadMBean; protected JTree threadTree; --- 57,63 ---- * @version $Revision$($Author$ / $Date$) */ ! public class ThreadMBeanThreadBrowserComponent extends JPanel implements DashboardComponent { ! protected ThreadMXBean threadMBean; protected JTree threadTree; *************** *** 67,70 **** --- 66,71 ---- protected DefaultMutableTreeNode root; + protected MBeanServer server; + protected Map threadMap; *************** *** 96,106 **** public void setContext(Map context) { MBeanServer mBeanServer = (MBeanServer) context.get(Dashboard.CONTEXT_MBEAN_SERVER); ! try { ! this.threadMBean = (ThreadMBean) MBeanServerInvocationHandler.newProxyInstance( mBeanServer, ! new ObjectName(ManagementFactory.THREAD_MBEAN_NAME), ! ThreadMBean.class, false); --- 97,108 ---- public void setContext(Map context) { MBeanServer mBeanServer = (MBeanServer) context.get(Dashboard.CONTEXT_MBEAN_SERVER); ! this.server = mBeanServer; try { ! ! this.threadMBean = (ThreadMXBean) MBeanServerInvocationHandler.newProxyInstance( mBeanServer, ! new ObjectName(ManagementFactory.THREAD_MXBEAN_NAME), ! ThreadMXBean.class, false); *************** *** 129,136 **** Arrays.sort(threadIds); ! ThreadInfo[] threadInfos = this.threadMBean.getThreadInfo(threadIds,Integer.MAX_VALUE); ! for (int i = 0; i < threadInfos.length; i++) { ! ThreadInfo threadInfo = threadInfos[i]; DefaultMutableTreeNode threadNode = null; --- 131,148 ---- Arrays.sort(threadIds); ! //this.threadMBean.getThreadInfo(threadIds,Integer.MAX_VALUE); ! ! CompositeData[] compositeDatas = ! (CompositeData[]) ! this.server.invoke( ! new ObjectName(ManagementFactory.THREAD_MXBEAN_NAME), ! "getThreadInfo", ! new Object[] { threadIds, new Integer(Integer.MAX_VALUE) }, ! new String[] { threadIds.getClass().getName(), Integer.TYPE.getName() }); ! ! ! for (int i = 0; i < compositeDatas.length; i++) { ! ThreadInfo threadInfo = ThreadInfo.from(compositeDatas[i]); DefaultMutableTreeNode threadNode = null; *************** *** 216,228 **** isThread = true; ! if (threadInfo.getThreadState().equals(ThreadState.RUNNABLE) || ! threadInfo.getThreadState().equals(ThreadState.RUNNABLE_IN_NATIVE)) { icon = threadRunningIcon; ! } else if (threadInfo.getThreadState().equals(ThreadState.WAITING) || ! threadInfo.getThreadState().equals(ThreadState.WAITING_IO)) { icon = threadWaitingIcon; ! } else if (threadInfo.getThreadState().equals(ThreadState.BLOCKED)) { icon = threadBlockedIcon; ! } else if (threadInfo.getThreadState().equals(ThreadState.TERMINATED)) { icon = threadTerminatedIcon; } else { --- 228,239 ---- isThread = true; ! if (threadInfo.getThreadState().equals(Thread.State.RUNNABLE)) { icon = threadRunningIcon; ! } else if (threadInfo.getThreadState().equals(Thread.State.WAITING) || ! threadInfo.getThreadState().equals(Thread.State.TIMED_WAITING)) { icon = threadWaitingIcon; ! } else if (threadInfo.getThreadState().equals(Thread.State.BLOCKED)) { icon = threadBlockedIcon; ! } else if (threadInfo.getThreadState().equals(Thread.State.TERMINATED)) { icon = threadTerminatedIcon; } else { Index: MemoryUsageLineChartComponent.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/jre15/components/MemoryUsageLineChartComponent.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MemoryUsageLineChartComponent.java 30 Apr 2004 17:23:46 -0000 1.3 --- MemoryUsageLineChartComponent.java 10 Jun 2004 18:15:07 -0000 1.4 *************** *** 35,38 **** --- 35,39 ---- import javax.management.MBeanServer; import javax.management.ObjectName; + import javax.management.openmbean.CompositeData; /** *************** *** 62,66 **** //String name = (String) this.server.getAttribute(objectName, "Name"); ! MemoryUsage usage = (MemoryUsage) this.server.getAttribute(objectName, "Usage"); TimeSeries ts = getTimeSeries(beanNode); --- 63,67 ---- //String name = (String) this.server.getAttribute(objectName, "Name"); ! MemoryUsage usage = MemoryUsage.from((CompositeData) this.server.getAttribute(objectName, "Usage")); TimeSeries ts = getTimeSeries(beanNode); Index: MemoryUsageComponent.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/jre15/components/MemoryUsageComponent.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MemoryUsageComponent.java 21 Mar 2004 21:35:50 -0000 1.1 --- MemoryUsageComponent.java 10 Jun 2004 18:15:07 -0000 1.2 *************** *** 19,30 **** package org.mc4j.jre15.components; ! import java.lang.management.MemoryUsage; ! ! import javax.management.MBeanAttributeInfo; import org.mc4j.console.dashboard.components.NumericAttributeGraph; ! import org.jfree.data.time.Millisecond; ! import org.jfree.data.time.TimeSeries; /** --- 19,31 ---- package org.mc4j.jre15.components; ! import org.jfree.data.time.Millisecond; ! import org.jfree.data.time.TimeSeries; import org.mc4j.console.dashboard.components.NumericAttributeGraph; ! import java.lang.management.MemoryUsage; ! ! import javax.management.MBeanAttributeInfo; ! import javax.management.openmbean.CompositeData; /** *************** *** 62,66 **** Object value = this.server.getAttribute(this.objectName, attributeName); ! MemoryUsage usage = (MemoryUsage) value; TimeSeries ts; --- 63,67 ---- Object value = this.server.getAttribute(this.objectName, attributeName); ! MemoryUsage usage = MemoryUsage.from((CompositeData) value); TimeSeries ts; Index: DeadlockDetectionComponent.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/jre15/components/DeadlockDetectionComponent.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DeadlockDetectionComponent.java 26 May 2004 03:11:01 -0000 1.1 --- DeadlockDetectionComponent.java 10 Jun 2004 18:15:07 -0000 1.2 *************** *** 22,34 **** import org.openide.ErrorManager; ! import org.mc4j.console.bean.MBeanNode; ! import org.mc4j.console.dashboard.components.BeanComponent; import java.lang.management.ManagementFactory; ! import java.lang.management.ThreadMBean; import java.util.Map; import javax.management.MBeanServerInvocationHandler; import javax.management.ObjectName; import javax.swing.JPanel; --- 22,41 ---- import org.openide.ErrorManager; ! import org.mc4j.console.dashboard.Dashboard; ! import org.mc4j.console.dashboard.DashboardComponent; + import java.awt.BorderLayout; import java.lang.management.ManagementFactory; ! import java.lang.management.ThreadInfo; ! import java.lang.management.ThreadMXBean; import java.util.Map; + import javax.management.MBeanServer; import javax.management.MBeanServerInvocationHandler; + import javax.management.MalformedObjectNameException; import javax.management.ObjectName; + import javax.management.openmbean.CompositeData; + import javax.swing.DefaultListModel; + import javax.swing.JList; import javax.swing.JPanel; *************** *** 39,67 **** * @version $Revision$($Author$ / $Date$) */ ! public class DeadlockDetectionComponent extends JPanel implements BeanComponent { ! MBeanNode beanNode; ! ThreadMBean threadMBean; - public void setBeanNode(MBeanNode node) { - this.beanNode = node; try { ! this.threadMBean = ! (ThreadMBean) ! MBeanServerInvocationHandler.newProxyInstance( ! node.getMBeanServer(), ! new ObjectName(ManagementFactory.THREAD_MBEAN_NAME), ! ThreadMBean.class, ! false); ! } catch(Exception e) { ! ErrorManager.getDefault().notify(e); } - } ! public void setContext(Map context) { } --- 46,112 ---- * @version $Revision$($Author$ / $Date$) */ ! public class DeadlockDetectionComponent extends JPanel implements DashboardComponent { ! ThreadMXBean threadMBean; ! MBeanServer server; ! JList list; ! DefaultListModel model; + public void setContext(Map context) { + + MBeanServer mBeanServer = (MBeanServer) context.get(Dashboard.CONTEXT_MBEAN_SERVER); + this.server = mBeanServer; try { ! this.threadMBean = (ThreadMXBean) ! MBeanServerInvocationHandler.newProxyInstance( ! mBeanServer, ! new ObjectName(ManagementFactory.THREAD_MXBEAN_NAME), ! ThreadMXBean.class, ! false); ! } catch (MalformedObjectNameException moe) { ! ErrorManager.getDefault().notify(moe); } ! ! ! list = new JList(); ! model = new DefaultListModel(); ! list.setModel(model); ! ! setLayout(new BorderLayout()); ! add(list, BorderLayout.CENTER); ! ! // Make some fake deadlock ! final Object a = new Object(), b = new Object(); ! ! Thread t1 = new Thread(new Runnable() { ! public void run() { ! while(true) { ! synchronized(a) { ! synchronized(b) { ! int a = 1+1; ! } ! } ! } ! }}); ! ! Thread t2 = new Thread(new Runnable() { ! public void run() { ! while(true) { ! synchronized(b) { ! synchronized(a) { ! int a = 1+1; ! } ! } ! } ! }}); ! t1.setName("Lock Test 1"); ! t2.setName("Lock Test 2"); ! t1.start(); ! t2.start(); } *************** *** 75,87 **** // TODO GH: This does not work yet! It doesn't appear to have been completed before // the beta release of 1.5 - Object result = - this.beanNode.getMBeanServer().invoke( - new ObjectName(ManagementFactory.THREAD_MBEAN_NAME), - "findMonitorDeadlockedThreads", - new Object[] {}, new String[] {}); if (result != null) { ! //output } } catch(Exception e) { ErrorManager.getDefault().notify(e); --- 120,148 ---- // TODO GH: This does not work yet! It doesn't appear to have been completed before // the beta release of 1.5 + long[] result = this.threadMBean.findMonitorDeadlockedThreads(); + + model.clear(); if (result != null) { ! for (int i = 0; i < result.length; i++) { ! long l = result[i]; ! try { ! ThreadInfo info = ! ThreadInfo.from( ! (CompositeData) ! server.invoke( ! new ObjectName(ManagementFactory.THREAD_MXBEAN_NAME), ! "getThreadInfo", ! new Object[] { new Long(l) }, ! new String[] { Long.TYPE.getName() })); ! ! model.addElement("Thread #: " + l + " " + info.getThreadName()); ! } catch (Exception e) { ! ErrorManager.getDefault().notify(e); ! } ! } } + + repaint(); } catch(Exception e) { ErrorManager.getDefault().notify(e); Index: MemoryUsagePieChartComponent.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/jre15/components/MemoryUsagePieChartComponent.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MemoryUsagePieChartComponent.java 9 Apr 2004 01:54:16 -0000 1.2 --- MemoryUsagePieChartComponent.java 10 Jun 2004 18:15:07 -0000 1.3 *************** *** 19,38 **** package org.mc4j.jre15.components; - import java.awt.BorderLayout; - import java.lang.management.MemoryUsage; - import java.util.Iterator; - import java.util.List; - import java.util.Map; - - import javax.management.MBeanServer; - import javax.management.ObjectName; - - import org.openide.windows.IOProvider; - - import org.mc4j.console.bean.MBeanNode; - import org.mc4j.console.dashboard.Dashboard; - import org.mc4j.console.dashboard.components.NumericAttributeGraph; - import org.mc4j.console.install.ExplorerUtil; - import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartMouseEvent; --- 19,22 ---- *************** *** 45,48 **** --- 29,49 ---- import org.jfree.data.DefaultPieDataset; + import org.openide.windows.IOProvider; + + import org.mc4j.console.bean.MBeanNode; + import org.mc4j.console.dashboard.Dashboard; + import org.mc4j.console.dashboard.components.NumericAttributeGraph; + import org.mc4j.console.install.ExplorerUtil; + + import java.awt.BorderLayout; + import java.lang.management.MemoryUsage; + import java.util.Iterator; + import java.util.List; + import java.util.Map; + + import javax.management.MBeanServer; + import javax.management.ObjectName; + import javax.management.openmbean.CompositeData; + /** * You use this like an Attribute Graph Panel and it shows a *************** *** 143,147 **** String name = (String) this.server.getAttribute(objectName, "Name"); ! MemoryUsage usage = (MemoryUsage) this.server.getAttribute(objectName, "Usage"); pieDataset.setValue(name, usage.getUsed()); --- 144,152 ---- String name = (String) this.server.getAttribute(objectName, "Name"); ! Object object = this.server.getAttribute(objectName, "Usage"); ! MemoryUsage usage = MemoryUsage.from((CompositeData) object); ! ! // Old support for beta 1 ! //usage = (MemoryUsage) this.server.getAttribute(objectName, "Usage"); pieDataset.setValue(name, usage.getUsed()); |
From: Greg H. <gh...@us...> - 2004-06-08 13:44:54
|
Update of /cvsroot/mc4j/mc4j/lib/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv928/lib/common Added Files: log4j-1.2.8.jar Log Message: Dependency of the latest JFreeChart --- NEW FILE: log4j-1.2.8.jar --- (This appears to be a binary file; contents omitted.) |
From: D.Samsonoff <dsa...@us...> - 2004-06-03 10:09:55
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/domain In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26276/src/org/mc4j/console/domain Modified Files: DomainNode.java Log Message: Futher group insertion fix, the problem with IllegalState exception was down to the fact that a node can not have more than one parent, in other words we did not clean up after attempting to regroup the nodes. Index: DomainNode.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/domain/DomainNode.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** DomainNode.java 2 Jun 2004 14:20:32 -0000 1.13 --- DomainNode.java 3 Jun 2004 10:09:45 -0000 1.14 *************** *** 30,36 **** --- 30,38 ---- import org.mc4j.console.install.ExplorerUtil; + import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; + import java.util.Date; import java.util.Enumeration; import java.util.HashMap; *************** *** 195,203 **** // For the stuff that's been categorized as much as it can be... ! for (Iterator iterator = children.iterator(); iterator.hasNext();) { MBeanNode beanNode = (MBeanNode) iterator.next(); if (!categorized.contains(beanNode)) { beanNode.filterName(categorizedKeys); ! parent.getChildren().add(new Node[] { beanNode }); } } --- 197,205 ---- // For the stuff that's been categorized as much as it can be... ! for (Iterator iterator = children.iterator(); iterator.hasNext();) { MBeanNode beanNode = (MBeanNode) iterator.next(); if (!categorized.contains(beanNode)) { beanNode.filterName(categorizedKeys); ! parent.getChildren().add(new Node[] { beanNode }); } } *************** *** 338,349 **** } if (!found) { //this should happen on the very last domain node //we are about to insert //are there any beans on this level that can now be groupped? ! beanNodes.add(childNode); ! Node[] current = new Node[beanNodes.size()]; ! //remove those beans that we are going to try to reinsert. ! node.getChildren().remove(current); ! distributeNode(beanNodes, node, categorizedKeys); } } --- 340,377 ---- } if (!found) { + + + beanNodes.add(childNode); //this should happen on the very last domain node //we are about to insert //are there any beans on this level that can now be groupped? ! //we are going to use a temporaly node which will weill attempt to redestribute ! DomainNode temp = new DomainNode("" + new Date().getTime()); ! ! ! //remove old bean nodes (they may be reinserted as domains now) ! Node old[] = new Node[beanNodes.size()]; ! old = (Node[]) beanNodes.toArray(old); ! node.getChildren().remove(old); ! ! //redistributed loose nodes ! distributeNode(beanNodes, temp, categorizedKeys); ! ! //copy children of the temp node into current ! Node[] newChildren = temp.getChildren().getNodes(); ! //nodes can't belong to more than one parent ! temp.getChildren().remove(newChildren); ! ! //reinsert ! node.getChildren().add(newChildren); ! ! //perform clean up... ! try ! { ! temp.destroy(); ! } catch (IOException e) ! { ! e.printStackTrace(); ! } } } *************** *** 357,361 **** */ public void insertIntoGroup(Node childNode) { ! insertNode(this, childNode, new HashSet()); } --- 385,392 ---- */ public void insertIntoGroup(Node childNode) { ! synchronized(groupLock) ! { ! insertNode(this, childNode, new HashSet()); ! } } |
From: D.Samsonoff <dsa...@us...> - 2004-06-02 14:20:42
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/domain In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1739/src/org/mc4j/console/domain Modified Files: DomainNode.java Log Message: Index: DomainNode.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/domain/DomainNode.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** DomainNode.java 2 Jun 2004 13:36:10 -0000 1.12 --- DomainNode.java 2 Jun 2004 14:20:32 -0000 1.13 *************** *** 342,346 **** //are there any beans on this level that can now be groupped? beanNodes.add(childNode); ! node.getChildren().remove(node.getChildren().getNodes()); distributeNode(beanNodes, node, categorizedKeys); } --- 342,348 ---- //are there any beans on this level that can now be groupped? beanNodes.add(childNode); ! Node[] current = new Node[beanNodes.size()]; ! //remove those beans that we are going to try to reinsert. ! node.getChildren().remove(current); distributeNode(beanNodes, node, categorizedKeys); } |
From: D.Samsonoff <dsa...@us...> - 2004-06-02 13:36:19
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/domain In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25564/src/org/mc4j/console/domain Modified Files: DomainNode.java Log Message: Fix for IllegalStateException for nodes that were already there. Index: DomainNode.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/domain/DomainNode.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** DomainNode.java 1 Jun 2004 19:45:23 -0000 1.11 --- DomainNode.java 2 Jun 2004 13:36:10 -0000 1.12 *************** *** 342,345 **** --- 342,346 ---- //are there any beans on this level that can now be groupped? beanNodes.add(childNode); + node.getChildren().remove(node.getChildren().getNodes()); distributeNode(beanNodes, node, categorizedKeys); } |
From: Greg H. <gh...@us...> - 2004-06-01 19:45:36
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/domain In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5595/src/org/mc4j/console/domain Modified Files: DomainNode.java Log Message: Re-adding the changes that were undone by dsamsonoff. (Synchronization and the removal list) Integrated with the corrected insert into grouped domain code. Fix for bugs #939971, #914838, #957714, #933080 (Note: the domain insert code is really duplicated, should be refactored to a single implementation) Index: DomainNode.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/domain/DomainNode.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** DomainNode.java 28 May 2004 10:59:11 -0000 1.10 --- DomainNode.java 1 Jun 2004 19:45:23 -0000 1.11 *************** *** 297,350 **** } } ! /** * Method goes through the domain nodes matching ObjectName * keys to each domain node name until it reaches the last domain node. ! * * The method is recursive. At each domain node the method accumulates a list of * bean just in case this is the leaf domain node and the bean nodes which could not * be previosly groupped can be groupped into new domain(s) using distributeNode() * method. ! * * @param node domain node * @param childNode bean node to insert * @param categorizedKeys processed keys ! * @see distributeNode(List children, DomainNode parent, Set categorizedKeys) */ ! public void insertNode(DomainNode node, Node childNode, Set categorizedKeys) ! { ! if(childNode instanceof MBeanNode) ! { MBeanNode beanNode = (MBeanNode) childNode; Hashtable props = beanNode.getObjectName().getKeyPropertyList(); Children children = node.getChildren(); ! ! boolean found = false; ArrayList beanNodes = new ArrayList(); ! for(Enumeration nodes = children.nodes(); nodes.hasMoreElements() && !found;) ! { Node next = (Node) nodes.nextElement(); ! if(next instanceof DomainNode ) ! { ! DomainNode childDomain = ((DomainNode) next); String key = childDomain.getName().split("=")[0]; ! ! found = props.get(key) != null; ! if(found) ! { categorizedKeys.add(key); insertNode(childDomain, childNode, categorizedKeys); } ! } ! else if(next instanceof MBeanNode)//other mbeannode add it to potential redistribution list ! { beanNodes.add(next); } ! } ! if(!found) //this should happen on the very last domain node ! { ! //we are about to insert ! //are there any beans on this level that can now be groupped? beanNodes.add(childNode); distributeNode(beanNodes, node, categorizedKeys); --- 297,344 ---- } } ! /** * Method goes through the domain nodes matching ObjectName * keys to each domain node name until it reaches the last domain node. ! * * The method is recursive. At each domain node the method accumulates a list of * bean just in case this is the leaf domain node and the bean nodes which could not * be previosly groupped can be groupped into new domain(s) using distributeNode() * method. ! * * @param node domain node * @param childNode bean node to insert * @param categorizedKeys processed keys ! * @see #distributeNode(java.util.List children, DomainNode parent, java.util.Set categorizedKeys) */ ! public void insertNode(DomainNode node, Node childNode, Set categorizedKeys) { ! if (childNode instanceof MBeanNode) { MBeanNode beanNode = (MBeanNode) childNode; Hashtable props = beanNode.getObjectName().getKeyPropertyList(); Children children = node.getChildren(); ! ! boolean found = false; ArrayList beanNodes = new ArrayList(); ! for (Enumeration nodes = children.nodes(); nodes.hasMoreElements() && !found;) { Node next = (Node) nodes.nextElement(); ! if (next instanceof DomainNode) { ! DomainNode childDomain = ((DomainNode) next); String key = childDomain.getName().split("=")[0]; ! ! found = props.get(key) != null; ! if (found) { categorizedKeys.add(key); insertNode(childDomain, childNode, categorizedKeys); } ! } else if (next instanceof MBeanNode) { ! //other mbeannode add it to potential redistribution list beanNodes.add(next); } ! } ! if (!found) { ! //this should happen on the very last domain node ! //we are about to insert ! //are there any beans on this level that can now be groupped? beanNodes.add(childNode); distributeNode(beanNodes, node, categorizedKeys); *************** *** 354,369 **** /** ! * Method triggers (recursive) insertion of a node into a hierachy of grouped ! * into domain beans. ! * * @param childNode */ ! public void insertIntoGroup(Node childNode) ! { insertNode(this, childNode, new HashSet()); } ! ! ! public void refresh() { // remove all unregistered (child-)mbean nodes (even if not expanded!) --- 348,362 ---- /** ! * Method triggers (recursive) insertion of a node into a hierachy of grouped ! * into domain beans. ! * * @param childNode */ ! public void insertIntoGroup(Node childNode) { insertNode(this, childNode, new HashSet()); } ! ! ! public void refresh() { // remove all unregistered (child-)mbean nodes (even if not expanded!) |
From: Greg H. <gh...@us...> - 2004-06-01 19:44:38
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/connection In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5437/src/org/mc4j/console/connection Modified Files: ConnectionNode.java Log Message: Re-adding the changes that were undone by dsamsonoff. (Synchronization and the removal list) Integrated with the corrected insert into grouped domain code. Fix for bugs #939971, #914838, #957714, #933080 (Note: the domain insert code is really duplicated, should be refactored to a single implementation) Index: ConnectionNode.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/connection/ConnectionNode.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** ConnectionNode.java 28 May 2004 11:28:27 -0000 1.30 --- ConnectionNode.java 1 Jun 2004 19:44:14 -0000 1.31 *************** *** 20,45 **** package org.mc4j.console.connection; - import java.beans.IntrospectionException; - import java.beans.PropertyChangeEvent; - import java.beans.PropertyChangeListener; - import java.io.IOException; - import java.util.ArrayList; - import java.util.Collections; - import java.util.HashMap; - import java.util.HashSet; - import java.util.Iterator; - import java.util.List; - import java.util.Map; - import java.util.Set; - import java.util.SortedSet; - import java.util.Timer; - import java.util.TimerTask; - import java.util.TreeSet; - - import javax.management.MBeanServer; - import javax.management.ObjectInstance; - import javax.management.ObjectName; - import javax.swing.SwingUtilities; - import org.openide.ErrorManager; import org.openide.actions.OpenLocalExplorerAction; --- 20,23 ---- *************** *** 67,71 **** import org.mc4j.console.query.NewQueryAction; ! import EDU.oswego.cs.dl.util.concurrent.PooledExecutor; /** --- 45,69 ---- import org.mc4j.console.query.NewQueryAction; ! import java.beans.IntrospectionException; ! import java.beans.PropertyChangeEvent; ! import java.beans.PropertyChangeListener; ! import java.io.IOException; ! import java.util.ArrayList; ! import java.util.Collections; ! import java.util.HashMap; ! import java.util.HashSet; ! import java.util.Iterator; ! import java.util.List; ! import java.util.Map; ! import java.util.Set; ! import java.util.SortedSet; ! import java.util.Timer; ! import java.util.TimerTask; ! import java.util.TreeSet; ! ! import javax.management.MBeanServer; ! import javax.management.ObjectInstance; ! import javax.management.ObjectName; ! import javax.swing.SwingUtilities; /** *************** *** 87,91 **** /** Holds a map of ObjectNames.getCannonicalName() to MBeanNodes */ ! protected Map mbeans = new HashMap(); protected Node.PropertySet[] settingsPropertySets; --- 85,89 ---- /** Holds a map of ObjectNames.getCannonicalName() to MBeanNodes */ ! protected volatile Map mbeans = new HashMap(); protected Node.PropertySet[] settingsPropertySets; *************** *** 93,97 **** private Timer refreshTimer; ! private PooledExecutor remoteExecutor; private Set openDashboards = new HashSet(); --- 91,95 ---- private Timer refreshTimer; ! //private PooledExecutor remoteExecutor; private Set openDashboards = new HashSet(); *************** *** 101,106 **** // Setup a working pool of up to 5 threads to process remote calls ! remoteExecutor = new PooledExecutor(5); ! remoteExecutor.waitWhenBlocked(); // Set self on domain nodes so they can alert us when someone expands us --- 99,104 ---- // Setup a working pool of up to 5 threads to process remote calls ! //remoteExecutor = new PooledExecutor(5); ! //remoteExecutor.waitWhenBlocked(); // Set self on domain nodes so they can alert us when someone expands us *************** *** 114,124 **** } ! /** ! * Provides access to the remote executor used to make calls to the remote server... ! * @return The pooled executor for this connection ! */ ! public PooledExecutor getExecutor() { ! return this.remoteExecutor; ! } public void propertyChange(PropertyChangeEvent evt) { --- 112,122 ---- } ! // /** ! // * Provides access to the remote executor used to make calls to the remote server... ! // * @return The pooled executor for this connection ! // */ ! // public PooledExecutor getExecutor() { ! // return this.remoteExecutor; ! // } public void propertyChange(PropertyChangeEvent evt) { *************** *** 173,178 **** protected void loadConnectionNodeChildren() throws Exception { ! ! String currentText = StatusDisplayer.getDefault().getStatusText(); try { StatusDisplayer.getDefault().setStatusText("Loading nodes [" + connectionSettings.getConnectionName() + "]"); --- 171,175 ---- protected void loadConnectionNodeChildren() throws Exception { ! //String currentText = StatusDisplayer.getDefault().getStatusText(); try { StatusDisplayer.getDefault().setStatusText("Loading nodes [" + connectionSettings.getConnectionName() + "]"); *************** *** 199,210 **** } ! Iterator iter = sortedObjectNames.iterator(); int i = 0; ! while (iter.hasNext()) { ObjectName objectName = (ObjectName) iter.next(); ! if ((this.mbeans == null) || (!this.mbeans.containsKey(objectName.getCanonicalName()))) { ! //org.openide.windows.IOProvider.getDefault().getStdOut().println("Mount MBean: " + objectInstance.getObjectName().getCanonicalName()); ! addMBean(objectName); } --- 196,215 ---- } ! // Create a secondary set that will be winowed with beans ! // that are still registered. Beans left in this set at the end ! // have been deregistered. ! HashSet oldMBeans = new HashSet(mbeans.keySet()); ! int i = 0; ! for (Iterator iter = sortedObjectNames.iterator(); iter.hasNext();) { ObjectName objectName = (ObjectName) iter.next(); ! synchronized(this) { ! if ((this.mbeans == null) || (!this.mbeans.containsKey(objectName.getCanonicalName()))) { ! //org.openide.windows.IOProvider.getDefault().getStdOut().println("Mount MBean: " + objectInstance.getObjectName().getCanonicalName()); ! addMBean(objectName); ! } else { ! oldMBeans.remove(objectName.getCanonicalName()); ! } } *************** *** 214,226 **** + "] " + i + " of " + objectNames.size()); } - // Don't refresh here, this.refresh already starts the chain of refreshes - /* else { - // refresh the existing one - //MBeanNode node = (MBeanNode) this.mbeans.get(objectInstance.getObjectName().getCanonicalName()); - //node.refresh(); - } - */ } } catch (Exception e) { StatusDisplayer.getDefault().setStatusText("Problem contacting server: " + --- 219,234 ---- + "] " + i + " of " + objectNames.size()); } } + // Clean out beans that have been unregistered + for (Iterator it = oldMBeans.iterator(); it.hasNext();) { + String mbeansKey = (String) it.next(); + + MBeanNode node = (MBeanNode) this.mbeans.get(mbeansKey); + node.getParentNode().getChildren().remove(new Node[] { node }); + + mbeans.remove(mbeansKey); + } + } catch (Exception e) { StatusDisplayer.getDefault().setStatusText("Problem contacting server: " + *************** *** 229,233 **** throw e; } finally { ! StatusDisplayer.getDefault().setStatusText(currentText); } } --- 237,241 ---- throw e; } finally { ! StatusDisplayer.getDefault().setStatusText(""); } } *************** *** 238,266 **** */ protected void addMBean(ObjectInstance objectInstance) { ! this.addMBean(objectInstance.getObjectName()); } protected void addMBean(ObjectName objectName) { ! String domain = objectName.getDomain(); ! DomainNode domainNode = (DomainNode) this.getChildren().findChild(domain); ! if (domainNode == null) { ! domainNode = new DomainNode(domain); ! this.getChildren().add(new Node[] { domainNode }); ! } - MBeanNode mbeanNode = new MBeanNode(objectName, this); - this.mbeans.put(objectName.getCanonicalName(), mbeanNode); ! ! if(domainNode.isGroupTypes()) ! { ! domainNode.insertIntoGroup(mbeanNode); ! } ! else ! { ! domainNode.getChildren().add(new Node[] { mbeanNode }); ! } } --- 246,273 ---- */ protected void addMBean(ObjectInstance objectInstance) { ! synchronized(this) { ! this.addMBean(objectInstance.getObjectName()); ! } } protected void addMBean(ObjectName objectName) { + synchronized(this) { + String domain = objectName.getDomain(); ! DomainNode domainNode = (DomainNode) this.getChildren().findChild(domain); ! if (domainNode == null) { ! domainNode = new DomainNode(domain); ! this.getChildren().add(new Node[] { domainNode }); ! } ! MBeanNode mbeanNode = new MBeanNode(objectName, this); ! this.mbeans.put(objectName.getCanonicalName(), mbeanNode); ! if(domainNode.isGroupTypes()) { ! domainNode.insertIntoGroup(mbeanNode); ! } else { ! domainNode.getChildren().add(new Node[] { mbeanNode }); ! } } } *************** *** 426,432 **** this.refreshTimer.cancel(); ! // Kill any outstanding requests ! this.remoteExecutor.shutdownNow(); ! setIconBase("org/mc4j/console/connection/DisconnectedConnectionNodeIcon"); this.getChildren().remove(this.getChildren().getNodes()); --- 433,437 ---- this.refreshTimer.cancel(); ! setIconBase("org/mc4j/console/connection/DisconnectedConnectionNodeIcon"); this.getChildren().remove(this.getChildren().getNodes()); *************** *** 496,502 **** public void browseToMBean(final ObjectName objectName) { ! final String name = objectName.getCanonicalName(); ! ! final MBeanNode node = (MBeanNode) this.mbeans.get(name); if (node != null) { ExplorerUtil.browseTo(node); --- 501,505 ---- public void browseToMBean(final ObjectName objectName) { ! final MBeanNode node = getMBeanNode(objectName); if (node != null) { ExplorerUtil.browseTo(node); |
From: D.Samsonoff <dsa...@us...> - 2004-05-28 11:28:51
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/connection In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30675/src/org/mc4j/console/connection Modified Files: ConnectionNode.java Log Message: Enhancement to allow insertion of bean nodes into grouped domains. Index: ConnectionNode.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/connection/ConnectionNode.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** ConnectionNode.java 26 May 2004 02:51:22 -0000 1.29 --- ConnectionNode.java 28 May 2004 11:28:27 -0000 1.30 *************** *** 20,23 **** --- 20,45 ---- package org.mc4j.console.connection; + import java.beans.IntrospectionException; + import java.beans.PropertyChangeEvent; + import java.beans.PropertyChangeListener; + import java.io.IOException; + import java.util.ArrayList; + import java.util.Collections; + import java.util.HashMap; + import java.util.HashSet; + import java.util.Iterator; + import java.util.List; + import java.util.Map; + import java.util.Set; + import java.util.SortedSet; + import java.util.Timer; + import java.util.TimerTask; + import java.util.TreeSet; + + import javax.management.MBeanServer; + import javax.management.ObjectInstance; + import javax.management.ObjectName; + import javax.swing.SwingUtilities; + import org.openide.ErrorManager; import org.openide.actions.OpenLocalExplorerAction; *************** *** 45,69 **** import org.mc4j.console.query.NewQueryAction; ! import java.beans.IntrospectionException; ! import java.beans.PropertyChangeEvent; ! import java.beans.PropertyChangeListener; ! import java.io.IOException; ! import java.util.ArrayList; ! import java.util.Collections; ! import java.util.HashMap; ! import java.util.HashSet; ! import java.util.Iterator; ! import java.util.List; ! import java.util.Map; ! import java.util.Set; ! import java.util.SortedSet; ! import java.util.Timer; ! import java.util.TimerTask; ! import java.util.TreeSet; ! ! import javax.management.MBeanServer; ! import javax.management.ObjectInstance; ! import javax.management.ObjectName; ! import javax.swing.SwingUtilities; /** --- 67,71 ---- import org.mc4j.console.query.NewQueryAction; ! import EDU.oswego.cs.dl.util.concurrent.PooledExecutor; /** *************** *** 85,89 **** /** Holds a map of ObjectNames.getCannonicalName() to MBeanNodes */ ! protected volatile Map mbeans = new HashMap(); protected Node.PropertySet[] settingsPropertySets; --- 87,91 ---- /** Holds a map of ObjectNames.getCannonicalName() to MBeanNodes */ ! protected Map mbeans = new HashMap(); protected Node.PropertySet[] settingsPropertySets; *************** *** 91,95 **** private Timer refreshTimer; ! //private PooledExecutor remoteExecutor; private Set openDashboards = new HashSet(); --- 93,97 ---- private Timer refreshTimer; ! private PooledExecutor remoteExecutor; private Set openDashboards = new HashSet(); *************** *** 99,104 **** // Setup a working pool of up to 5 threads to process remote calls ! //remoteExecutor = new PooledExecutor(5); ! //remoteExecutor.waitWhenBlocked(); // Set self on domain nodes so they can alert us when someone expands us --- 101,106 ---- // Setup a working pool of up to 5 threads to process remote calls ! remoteExecutor = new PooledExecutor(5); ! remoteExecutor.waitWhenBlocked(); // Set self on domain nodes so they can alert us when someone expands us *************** *** 112,122 **** } ! // /** ! // * Provides access to the remote executor used to make calls to the remote server... ! // * @return The pooled executor for this connection ! // */ ! // public PooledExecutor getExecutor() { ! // return this.remoteExecutor; ! // } public void propertyChange(PropertyChangeEvent evt) { --- 114,124 ---- } ! /** ! * Provides access to the remote executor used to make calls to the remote server... ! * @return The pooled executor for this connection ! */ ! public PooledExecutor getExecutor() { ! return this.remoteExecutor; ! } public void propertyChange(PropertyChangeEvent evt) { *************** *** 197,216 **** } ! // Create a secondary set that will be winowed with beans ! // that are still registered. Beans left in this set at the end ! // have been deregistered. ! HashSet oldMBeans = new HashSet(mbeans.keySet()); ! int i = 0; ! for (Iterator iter = sortedObjectNames.iterator(); iter.hasNext();) { ObjectName objectName = (ObjectName) iter.next(); ! synchronized(this) { ! if ((this.mbeans == null) || (!this.mbeans.containsKey(objectName.getCanonicalName()))) { ! //org.openide.windows.IOProvider.getDefault().getStdOut().println("Mount MBean: " + objectInstance.getObjectName().getCanonicalName()); ! addMBean(objectName); ! } else { ! oldMBeans.remove(objectName.getCanonicalName()); ! } } --- 199,210 ---- } ! Iterator iter = sortedObjectNames.iterator(); int i = 0; ! while (iter.hasNext()) { ObjectName objectName = (ObjectName) iter.next(); ! if ((this.mbeans == null) || (!this.mbeans.containsKey(objectName.getCanonicalName()))) { ! //org.openide.windows.IOProvider.getDefault().getStdOut().println("Mount MBean: " + objectInstance.getObjectName().getCanonicalName()); ! addMBean(objectName); } *************** *** 220,236 **** + "] " + i + " of " + objectNames.size()); } } - // Clean out beans that have been unregistered - for (Iterator it = oldMBeans.iterator(); it.hasNext();) { - String mbeansKey = (String) it.next(); - - MBeanNode node = (MBeanNode) this.mbeans.get(mbeansKey); - node.getParentNode().getChildren().remove(new Node[] { node }); - - mbeans.remove(mbeansKey); - - } - } catch (Exception e) { StatusDisplayer.getDefault().setStatusText("Problem contacting server: " + --- 214,226 ---- + "] " + i + " of " + objectNames.size()); } + // Don't refresh here, this.refresh already starts the chain of refreshes + /* else { + // refresh the existing one + //MBeanNode node = (MBeanNode) this.mbeans.get(objectInstance.getObjectName().getCanonicalName()); + //node.refresh(); + } + */ } } catch (Exception e) { StatusDisplayer.getDefault().setStatusText("Problem contacting server: " + *************** *** 248,271 **** */ protected void addMBean(ObjectInstance objectInstance) { ! synchronized(this) { ! this.addMBean(objectInstance.getObjectName()); ! } } protected void addMBean(ObjectName objectName) { - synchronized(this) { - String domain = objectName.getDomain(); ! DomainNode domainNode = (DomainNode) this.getChildren().findChild(domain); ! if (domainNode == null) { ! domainNode = new DomainNode(domain); ! this.getChildren().add(new Node[] { domainNode }); ! } ! MBeanNode mbeanNode = new MBeanNode(objectName, this); ! this.mbeans.put(objectName.getCanonicalName(), mbeanNode); ! domainNode.getChildren().add( ! new Node[] { mbeanNode }); } } --- 238,266 ---- */ protected void addMBean(ObjectInstance objectInstance) { ! this.addMBean(objectInstance.getObjectName()); } protected void addMBean(ObjectName objectName) { ! String domain = objectName.getDomain(); ! DomainNode domainNode = (DomainNode) this.getChildren().findChild(domain); ! if (domainNode == null) { ! domainNode = new DomainNode(domain); ! this.getChildren().add(new Node[] { domainNode }); ! } ! MBeanNode mbeanNode = new MBeanNode(objectName, this); ! this.mbeans.put(objectName.getCanonicalName(), mbeanNode); ! ! ! if(domainNode.isGroupTypes()) ! { ! domainNode.insertIntoGroup(mbeanNode); ! } ! else ! { ! domainNode.getChildren().add(new Node[] { mbeanNode }); ! } } *************** *** 432,436 **** // Kill any outstanding requests ! //this.remoteExecutor.shutdownNow(); setIconBase("org/mc4j/console/connection/DisconnectedConnectionNodeIcon"); --- 427,431 ---- // Kill any outstanding requests ! this.remoteExecutor.shutdownNow(); setIconBase("org/mc4j/console/connection/DisconnectedConnectionNodeIcon"); *************** *** 501,505 **** public void browseToMBean(final ObjectName objectName) { ! final MBeanNode node = getMBeanNode(objectName); if (node != null) { ExplorerUtil.browseTo(node); --- 496,502 ---- public void browseToMBean(final ObjectName objectName) { ! final String name = objectName.getCanonicalName(); ! ! final MBeanNode node = (MBeanNode) this.mbeans.get(name); if (node != null) { ExplorerUtil.browseTo(node); |
From: D.Samsonoff <dsa...@us...> - 2004-05-28 10:59:24
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/domain In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25443/src/org/mc4j/console/domain Modified Files: DomainNode.java Log Message: Index: DomainNode.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/domain/DomainNode.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** DomainNode.java 26 May 2004 02:51:23 -0000 1.9 --- DomainNode.java 28 May 2004 10:59:11 -0000 1.10 *************** *** 21,24 **** --- 21,25 ---- import org.openide.nodes.AbstractNode; + import org.openide.nodes.Children; import org.openide.nodes.Node; import org.openide.util.HelpCtx; *************** *** 32,35 **** --- 33,37 ---- import java.util.Collections; import java.util.Comparator; + import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; *************** *** 295,299 **** --- 297,369 ---- } } + + /** + * Method goes through the domain nodes matching ObjectName + * keys to each domain node name until it reaches the last domain node. + * + * The method is recursive. At each domain node the method accumulates a list of + * bean just in case this is the leaf domain node and the bean nodes which could not + * be previosly groupped can be groupped into new domain(s) using distributeNode() + * method. + * + * @param node domain node + * @param childNode bean node to insert + * @param categorizedKeys processed keys + * @see distributeNode(List children, DomainNode parent, Set categorizedKeys) + */ + public void insertNode(DomainNode node, Node childNode, Set categorizedKeys) + { + if(childNode instanceof MBeanNode) + { + MBeanNode beanNode = (MBeanNode) childNode; + Hashtable props = beanNode.getObjectName().getKeyPropertyList(); + Children children = node.getChildren(); + + boolean found = false; + ArrayList beanNodes = new ArrayList(); + for(Enumeration nodes = children.nodes(); nodes.hasMoreElements() && !found;) + { + Node next = (Node) nodes.nextElement(); + if(next instanceof DomainNode ) + { + DomainNode childDomain = ((DomainNode) next); + String key = childDomain.getName().split("=")[0]; + + found = props.get(key) != null; + if(found) + { + categorizedKeys.add(key); + insertNode(childDomain, childNode, categorizedKeys); + } + } + else if(next instanceof MBeanNode)//other mbeannode add it to potential redistribution list + { + beanNodes.add(next); + } + + } + if(!found) //this should happen on the very last domain node + { + //we are about to insert + //are there any beans on this level that can now be groupped? + beanNodes.add(childNode); + distributeNode(beanNodes, node, categorizedKeys); + } + } + } + /** + * Method triggers (recursive) insertion of a node into a hierachy of grouped + * into domain beans. + * + * @param childNode + */ + public void insertIntoGroup(Node childNode) + { + insertNode(this, childNode, new HashSet()); + } + + + public void refresh() { // remove all unregistered (child-)mbean nodes (even if not expanded!) |
From: Greg H. <gh...@us...> - 2004-05-26 13:34:14
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/connection In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25637/src/org/mc4j/console/connection Modified Files: JSR160ConnectionNode.java Log Message: Putting principal/credentials in initial context properties as well as jmx connector properties for secured jndi access. Index: JSR160ConnectionNode.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/connection/JSR160ConnectionNode.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** JSR160ConnectionNode.java 26 May 2004 03:02:50 -0000 1.10 --- JSR160ConnectionNode.java 26 May 2004 13:34:02 -0000 1.11 *************** *** 70,73 **** --- 70,76 ---- env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.rmi.registry.RegistryContextFactory"); } + env.put(Context.SECURITY_PRINCIPAL, connectionSettings.getPrincipal()); + env.put(Context.SECURITY_CREDENTIALS, connectionSettings.getCredentials()); + // Set and custom, advanced properties |
From: Greg H. <gh...@us...> - 2004-05-26 03:15:02
|
Update of /cvsroot/mc4j/mc4j/lib/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23306/lib/common Added Files: jcommon-0.9.3.jar jfreechart-0.9.18.jar Removed Files: jcommon-0.9.2.jar jfreechart-0.9.17.jar Log Message: Upgrade of JFreeChart to 0.9.18 to support the new stacked area, time-category chart. --- NEW FILE: jcommon-0.9.3.jar --- (This appears to be a binary file; contents omitted.) --- jcommon-0.9.2.jar DELETED --- --- jfreechart-0.9.17.jar DELETED --- --- NEW FILE: jfreechart-0.9.18.jar --- (This appears to be a binary file; contents omitted.) |
From: Greg H. <gh...@us...> - 2004-05-26 03:11:14
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/jre15/components In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22898/src/org/mc4j/jre15/components Added Files: DeadlockDetectionComponent.java MemoryUsageAreaChartComponent.java Log Message: Added a stacked area chart for memory pool usage. (Also added a deadlock detection component, but the JDKs support for it isn't finished) --- NEW FILE: MemoryUsageAreaChartComponent.java --- /* * Author: Greg Hinkle * * The contents of this file are subject to the Sapient Public License Version 1.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy of the * License at http://mc4j.sf.net/License-SPL.html. * * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, * either express or implied. See the License for the specific language governing rights and limitations * under the License. * * The Original Code is The MC4J Management Console * The Initial Developer of the Original Code is Greg Hinkle (gh...@us...) * Copyright (C) 2004 Greg Hinkle. All Rights Reserved. * * Redistributions of code or binary files using or based on this code must reproduce the * above copyright and disclaimer. For more information see <http://mc4j.sourceforge.net>. */ package org.mc4j.jre15.components; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.axis.DateAxis; import org.jfree.chart.labels.XYItemLabelGenerator; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.renderer.StackedXYAreaRenderer; import org.jfree.data.XYDataset; import org.jfree.data.time.BoundedTimeTableXYDataset; import org.jfree.data.time.Millisecond; import org.jfree.data.time.RegularTimePeriod; import org.mc4j.console.bean.MBeanNode; import org.mc4j.console.bean.attribute.AttributeNode; import org.mc4j.console.dashboard.Dashboard; import org.mc4j.console.dashboard.components.BeanListComponent; import org.mc4j.console.dashboard.components.NumericAttributeGraph; import java.awt.BorderLayout; import java.awt.Color; import java.lang.management.MemoryUsage; import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.management.MBeanServer; import javax.management.ObjectName; import javax.swing.border.LineBorder; /** * You use this like an Attribute Graph Panel and it shows a * graph of MemoryUsage object information. * * @author Greg Hinkle (gh...@us...), Mar 7, 2004 * @version $Revision: 1.1 $($Author: ghinkl $ / $Date: 2004/05/26 03:11:02 $) */ public class MemoryUsageAreaChartComponent extends NumericAttributeGraph implements BeanListComponent { public static final String USED = "Used"; protected List beanList; protected List nameList = new ArrayList(); protected BoundedTimeTableXYDataset dataset2 = new BoundedTimeTableXYDataset(); protected RegularTimePeriod removeArray[] = new RegularTimePeriod[60]; protected int removalIndex = 0; protected void initGraphPanel() { } NumberFormat format = new DecimalFormat("#.#"); protected void initGraphPanel2() { this.chart = ChartFactory.createStackedXYAreaChart( "Memory Pool Size Chart", // chart title "Time", // domain axis label "Pool Size (Bytes)", // range axis label dataset2, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, false ); DateAxis domain = new DateAxis("Time"); domain.setAutoRange(true); domain.setLowerMargin(0.0); domain.setUpperMargin(0.0); this.chart.getXYPlot().setDomainAxis(domain); StackedXYAreaRenderer renderer = (StackedXYAreaRenderer) this.chart.getXYPlot().getRenderer(); renderer.setBaseLabelGenerator(new XYItemLabelGenerator() { public String generateItemLabel(XYDataset dataset, int series, int item) { Number x = dataset.getXValue(series, item); long bytes = x.longValue(); if (bytes > 1E9) { return format.format(bytes/1E9) + " GB"; } else if (bytes > 1E6) { return format.format(bytes/1E6) + " MB"; } else if (bytes > 1E3) { return format.format(bytes/1E3) + " KB"; } else { return bytes + " B"; } } }); ChartPanel chartPanel = new ChartPanel(chart,false,true,true,false,false); //chartPanel.setPopupMenu(null); chartPanel.setOpaque(true); chartPanel.setDoubleBuffered(false); chart.setBackgroundPaint(this.getBackground()); chartPanel.setBackground(this.getBackground()); chartPanel.setBorder(new LineBorder(Color.BLACK,1)); setLayout(new BorderLayout()); setOpaque(false); add(chartPanel,BorderLayout.CENTER); doLayout(); repaint(); } public void updateRange() { // shrug this.chart.getXYPlot().getDomainAxis().setAutoRange(true); this.chart.getXYPlot().getRangeAxis().setAutoRange(true); } public int getUpdateInterval() { return 1000; } long time = 2; int seriesIndex = 0; public void addObservation() throws Exception { Millisecond time = new Millisecond(); //time = System.currentTimeMillis(); for (Iterator iterator = beanList.iterator(); iterator.hasNext();) { try { MBeanNode beanNode = (MBeanNode) iterator.next(); ObjectName objectName = beanNode.getObjectName(); MemoryUsage usage = (MemoryUsage) this.server.getAttribute(objectName, "Usage"); String name = (String) ((AttributeNode)beanNode.getAttributeNodeMap().get("Name")).getValue(); dataset2.add(time, new Long(usage.getUsed()), name, false); } catch(Exception e) { e.printStackTrace(); } } dataset2.rebound(); chart.fireChartChanged(); } public void setBeanList(List beanList) { this.beanList = beanList; } public void setContext(Map context) { if (beanList == null) { throw new IllegalStateException( "MemoryUsageAreaChartComponent: context atribute [beanList] not set."); } this.server = (MBeanServer) context.get(Dashboard.CONTEXT_MBEAN_SERVER); ArrayList list = new ArrayList(); Collections.reverse(beanList); for (Iterator iterator = beanList.iterator(); iterator.hasNext();) { MBeanNode beanNode = (MBeanNode) iterator.next(); ObjectName objectName = beanNode.getObjectName(); try { String name = (String) this.server.getAttribute(objectName, "Name"); this.nameList.add(name); } catch (Exception e) { e.printStackTrace(); } } initGraphPanel2(); reschedule(); } } --- NEW FILE: DeadlockDetectionComponent.java --- /* * Author: Greg Hinkle * * The contents of this file are subject to the Sapient Public License Version 1.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy of the * License at http://mc4j.sf.net/License-SPL.html. * * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, * either express or implied. See the License for the specific language governing rights and limitations * under the License. * * The Original Code is The MC4J Management Console * The Initial Developer of the Original Code is Greg Hinkle (gh...@us...) * Copyright (C) 2004 Greg Hinkle. All Rights Reserved. * * Redistributions of code or binary files using or based on this code must reproduce the * above copyright and disclaimer. For more information see <http://mc4j.sourceforge.net>. */ package org.mc4j.jre15.components; import org.openide.ErrorManager; import org.mc4j.console.bean.MBeanNode; import org.mc4j.console.dashboard.components.BeanComponent; import java.lang.management.ManagementFactory; import java.lang.management.ThreadMBean; import java.util.Map; import javax.management.MBeanServerInvocationHandler; import javax.management.ObjectName; import javax.swing.JPanel; /** * @author Greg Hinkle (gh...@us...), January 2002 * @version $Revision: 1.1 $($Author: ghinkl $ / $Date: 2004/05/26 03:11:01 $) */ public class DeadlockDetectionComponent extends JPanel implements BeanComponent { MBeanNode beanNode; ThreadMBean threadMBean; public void setBeanNode(MBeanNode node) { this.beanNode = node; try { this.threadMBean = (ThreadMBean) MBeanServerInvocationHandler.newProxyInstance( node.getMBeanServer(), new ObjectName(ManagementFactory.THREAD_MBEAN_NAME), ThreadMBean.class, false); } catch(Exception e) { ErrorManager.getDefault().notify(e); } } public void setContext(Map context) { } public void refresh() { if (!this.threadMBean.isThreadContentionMonitoringEnabled()) { this.threadMBean.setThreadContentionMonitoringEnabled(true); } try { // TODO GH: This does not work yet! It doesn't appear to have been completed before // the beta release of 1.5 Object result = this.beanNode.getMBeanServer().invoke( new ObjectName(ManagementFactory.THREAD_MBEAN_NAME), "findMonitorDeadlockedThreads", new Object[] {}, new String[] {}); if (result != null) { //output } } catch(Exception e) { ErrorManager.getDefault().notify(e); } } } |
From: Greg H. <gh...@us...> - 2004-05-26 03:11:13
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/swing/graph/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22898/src/org/mc4j/console/swing/graph/data Added Files: BoundedTimeTableXYDataset.java Log Message: Added a stacked area chart for memory pool usage. (Also added a deadlock detection component, but the JDKs support for it isn't finished) --- NEW FILE: BoundedTimeTableXYDataset.java --- /* =========================================================== * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * * (C) Copyright 2000-2004, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * --------------- * TimeSeries.java * --------------- * (C) Copyright 2001-2003, by Object Refinery Limited. * * Original Author: Andreas Schroeder; * Contributor(s): -; * * $Id: BoundedTimeTableXYDataset.java,v 1.1 2004/05/26 03:10:59 ghinkl Exp $ * * Changes * ------- * 01-Apr-2004 : Version 1 (AS); * */ package org.jfree.data.time; import org.jfree.data.AbstractSeriesDataset; import org.jfree.data.DefaultKeyedValues2D; import org.jfree.data.DomainInfo; import org.jfree.data.IntervalXYDataset; import org.jfree.data.Range; import org.jfree.data.TableXYDataset; import java.util.Calendar; import java.util.List; import java.util.Locale; import java.util.TimeZone; /** * * A dataset for regular time periods that implements the TableXYDataset * interface. * * @see org.jfree.data.TableXYDataset * @author andreas.schroeder */ public class BoundedTimeTableXYDataset extends AbstractSeriesDataset implements IntervalXYDataset, DomainInfo, TableXYDataset { private int timeCount = 60; /** * The data structure to store the values. */ private DefaultKeyedValues2D values; /** * A flag that indicates that the domain is 'points in time'. If this flag is true, only * the x-value is used to determine the range of values in the domain, the start and end * x-values are ignored. */ private boolean domainIsPointsInTime; /** A working calendar (to recycle) */ private Calendar workingCalendar; /** * The point within each time period that is used for the X value when this collection is used * as an {@link org.jfree.data.XYDataset}. This can be the start, middle or end of the * time period. */ private TimePeriodAnchor xPosition; /** * Creates a new TimeTableDataset. */ public BoundedTimeTableXYDataset() { this(TimeZone.getDefault(), Locale.getDefault()); } /** * Creates a new TimeTableDataset with the given time zone. * * @param zone the time zone to use. */ public BoundedTimeTableXYDataset(TimeZone zone) { this(zone, Locale.getDefault()); } /** * Creates a new TimeTableDataset with the given time zone and locale. * * @param zone the time zone to use. * @param locale the locale to use. */ public BoundedTimeTableXYDataset(TimeZone zone, Locale locale) { this.values = new DefaultKeyedValues2D(true); this.workingCalendar = Calendar.getInstance(zone, locale); this.xPosition = TimePeriodAnchor.START; } /** * Adds a new data item to the dataset. * * @param period the time period. * @param y the value for this period. * @param seriesName the name of the series to add the value. */ public void add(RegularTimePeriod period, double y, String seriesName) { add(period, new Double(y), seriesName, true); } /** * Adds a new data item to the dataset. * * @param period the time period. * @param y the value for this period. * @param seriesName the name of the series to add the value. * @param notify wether dataset listener are notified or not. */ public void add(RegularTimePeriod period, Number y, String seriesName, boolean notify) { this.values.addValue(y, period, seriesName); if (notify) { fireDatasetChanged(); } } public void rebound() { if (this.values.getRowCount() > this.timeCount) { this.values.removeRow(0); } fireDatasetChanged(); } /** * Removes an existing data item from the dataset. * * @param period the (existing!) time period of the value to remove. * @param seriesName the (existing!) series name to remove the value. */ public void remove(RegularTimePeriod period, String seriesName) { remove(period, seriesName, true); } /** * Removes an existing data item from the dataset. * * @param period the (existing!) time period of the value to remove. * @param seriesName the (existing!) series name to remove the value. * @param notify wether dataset listener are notified or not. */ public void remove(RegularTimePeriod period, String seriesName, boolean notify) { this.values.removeValue(period, seriesName); if (notify) { fireDatasetChanged(); } } /** * Returns the number of items every series. * * @return the item count. */ public int getItemCount() { return this.values.getRowCount(); } /** * Returns the number of items in a series. * * @param series the series (zero-based index). * * @return the number of items within the series. */ public int getItemCount(int series) { return getItemCount(); } /** * Returns the number of series in the dataset. * * @return the series count. */ public int getSeriesCount() { return this.values.getColumnCount(); } /** * Returns the name of a series. * * @param series the series (zero-based index). * * @return the name of the series. */ public String getSeriesName(int series) { return this.values.getColumnKey(series).toString(); } /** * Returns the x-value for an item within a series. The x-values may or may not be returned * in ascending order, that is up to the class implementing the interface. * * @param series the series (zero-based index). * @param item the item (zero-based index). * * @return the x-value. */ public Number getXValue(int series, int item) { RegularTimePeriod period = (RegularTimePeriod) this.values.getRowKey(item); return new Long(getX(period)); } /** * Returns the starting X value for the specified series and item. * * @param series the series (zero-based index). * @param item the item within a series (zero-based index). * * @return the starting X value for the specified series and item. */ public Number getStartXValue(int series, int item) { RegularTimePeriod period = (RegularTimePeriod) this.values.getRowKey(item); return new Long(period.getFirstMillisecond(this.workingCalendar)); } /** * Returns the ending X value for the specified series and item. * * @param series the series (zero-based index). * @param item the item within a series (zero-based index). * * @return the ending X value for the specified series and item. */ public Number getEndXValue(int series, int item) { RegularTimePeriod period = (RegularTimePeriod) this.values.getRowKey(item); return new Long(period.getLastMillisecond(this.workingCalendar)); } /** * Returns the y-value for an item within a series. * * @param series the series (zero-based index). * @param item the item (zero-based index). * * @return the y-value (possibly <code>null</code>). */ public Number getYValue(int series, int item) { return this.values.getValue(item, series); } /** * Returns the starting Y value for the specified series and item. * * @param series the series (zero-based index). * @param item the item within a series (zero-based index). * * @return starting Y value for the specified series and item. */ public Number getStartYValue(int series, int item) { return getYValue(series, item); } /** * Returns the ending Y value for the specified series and item. * * @param series the series (zero-based index). * @param item the item within a series (zero-based index). * * @return the ending Y value for the specified series and item. */ public Number getEndYValue(int series, int item) { return getYValue(series, item); } /** * Returns the x-value for a time period. * * @param period the time period. * * @return the x-value. */ private long getX(RegularTimePeriod period) { long result = 0L; if (this.xPosition == TimePeriodAnchor.START) { result = period.getFirstMillisecond(this.workingCalendar); } else if (this.xPosition == TimePeriodAnchor.MIDDLE) { result = period.getMiddleMillisecond(this.workingCalendar); } else if (this.xPosition == TimePeriodAnchor.END) { result = period.getLastMillisecond(this.workingCalendar); } return result; } /** * Returns the minimum value in the dataset (or <code>null</code> if all the values in * the domain are <code>null</code>). * * @return The minimum value. */ public Number getMinimumDomainValue() { return new Double(getDomainRange().getLowerBound()); } /** * Returns the maximum value in the dataset (or <code>null</code> if all the values in * the domain are <code>null</code>). * * @return The maximum value. */ public Number getMaximumDomainValue() { return new Double(getDomainRange().getUpperBound()); } /** * Returns the range of the values in this dataset's domain. * * @return The range. */ public Range getDomainRange() { List keys = this.values.getRowKeys(); if (keys.isEmpty()) { return null; } RegularTimePeriod first = (RegularTimePeriod) keys.get(0); RegularTimePeriod last = (RegularTimePeriod) keys.get(keys.size() - 1); if (this.domainIsPointsInTime) { return new Range(getX(first), getX(last)); } else { return new Range(first.getFirstMillisecond(this.workingCalendar), last.getLastMillisecond(this.workingCalendar)); } } /** * Returns a flag that controls whether the domain is treated as 'points in time'. * <P> * This flag is used when determining the max and min values for the domain. If true, then * only the x-values are considered for the max and min values. If false, then the start and * end x-values will also be taken into consideration * * @return the flag. */ public boolean getDomainIsPointsInTime() { return this.domainIsPointsInTime; } /** * Sets a flag that controls whether the domain is treated as 'points in time', or time * periods. * * @param flag The new value of the flag. */ public void setDomainIsPointsInTime(boolean flag) { this.domainIsPointsInTime = flag; } } |
From: Greg H. <gh...@us...> - 2004-05-26 03:11:12
|
Update of /cvsroot/mc4j/mc4j/application/dashboards/jre15 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22898/application/dashboards/jre15 Added Files: JRE15_MemoryUsage_AreaChart.xml Log Message: Added a stacked area chart for memory pool usage. (Also added a deadlock detection component, but the JDKs support for it isn't finished) --- NEW FILE: JRE15_MemoryUsage_AreaChart.xml --- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE Dashboard PUBLIC "-//MC4J//DTD Dashboard 1.0//EN" "http://mc4j.sourceforge.net/Dashboard_1_0.dtd"> <Dashboard version="1.0" name="Pool Usage Area Chart"> <Description>Memory usage chart of pools for a 1.5 JVM.</Description> <DashboardMatch type="Global" location="/JVM/Memory"> <BeanMatch id="MemoryPools" type="Multiple"> <Condition type="BeanObjectNameCondition" filter="type=MemoryPool"/> </BeanMatch> </DashboardMatch> <LayoutManager type="java.awt.BorderLayout"/> <Content> <!-- *** The header section displays title and a refresh control *** --> <Component type="javax.swing.JPanel"> <Constraint type="BorderConstraints" direction="NORTH"/> <LayoutManager type="java.awt.BorderLayout"/> <Border type="javax.swing.border.EmptyBorder" top="(Literal)2" left="(Literal)5" bottom="(Literal)2" right="(Literal)5"/> <Content> <Component type="javax.swing.JPanel"> <Constraint type="BorderConstraints" direction="CENTER"/> <LayoutManager type="java.awt.BorderLayout"/> <Content> <Component type="javax.swing.JLabel" id="titleLable"> <Constraint type="BorderConstraints" direction="CENTER"/> <Attribute name="text" value="DashboardName"/> <Attribute name="font" value="(Literal)SansSerif bold 20"/> <Attribute name="foreground" value="(Literal)0x666666"/> </Component> <Component type="javax.swing.JTextArea"> <Constraint type="BorderConstraints" direction="SOUTH"/> <Attribute name="text" value="DashboardDescription"/> <Attribute name="font" value="(Literal)DialogInput bold 14"/> <Attribute name="opaque" value="(Literal)false"/> <Attribute name="editable" value="(Literal)false"/> </Component> </Content> </Component> </Content> </Component> <Component type="org.mc4j.jre15.components.MemoryUsageAreaChartComponent"> <Attribute name="beanList" value="MemoryPools"/> <Attribute name="preferredSize" value="(Literal)400,250"/> </Component> </Content> </Dashboard> |
From: Greg H. <gh...@us...> - 2004-05-26 03:08:58
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/swing/graph/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22575/src/org/mc4j/console/swing/graph/data Log Message: Directory /cvsroot/mc4j/mc4j/src/org/mc4j/console/swing/graph/data added to the repository |
From: Greg H. <gh...@us...> - 2004-05-26 03:06:54
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard/global In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22239/src/org/mc4j/console/dashboard/global Modified Files: GlobalDashboardSetNode.java Log Message: Fix for bug #955973. Only allow refreshes at the root global dashboard level. This actually completely rematches all of the dashboards against the tree. Index: GlobalDashboardSetNode.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard/global/GlobalDashboardSetNode.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GlobalDashboardSetNode.java 7 Apr 2004 15:27:36 -0000 1.4 --- GlobalDashboardSetNode.java 26 May 2004 03:06:45 -0000 1.5 *************** *** 43,46 **** --- 43,48 ---- private ConnectionNode parentConnection; + private boolean rootSet = false; + public GlobalDashboardSetNode(ConnectionNode parentConnection) { super(new GlobalDashboardChildren()); *************** *** 57,62 **** setDisplayName("Global Dashboards"); ! ! setShortDescription("A set of dashboards that generically show information about a server."); } --- 59,65 ---- setDisplayName("Global Dashboards"); ! ! rootSet = true; ! setShortDescription("A set of dashboards that generically show information about a server."); } *************** *** 82,88 **** */ protected SystemAction[] createActions() { ! return new SystemAction[] { ! NodeAction.get(RefreshAction.class) ! }; } --- 85,95 ---- */ protected SystemAction[] createActions() { ! if (rootSet) { ! return new SystemAction[] { ! NodeAction.get(RefreshAction.class) ! }; ! } else { ! return new SystemAction[] { }; ! } } |
From: Greg H. <gh...@us...> - 2004-05-26 03:05:02
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/connection/persistence In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21956/src/org/mc4j/console/connection/persistence Modified Files: ConnectionSettings.java Log Message: Support for arbitrary additional connection properties. Currently only works with JSR160 connections. RFE #951493. Index: ConnectionSettings.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/connection/persistence/ConnectionSettings.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ConnectionSettings.java 21 Apr 2004 20:38:17 -0000 1.10 --- ConnectionSettings.java 26 May 2004 03:04:52 -0000 1.11 *************** *** 22,25 **** --- 22,26 ---- import java.io.ObjectStreamField; import java.io.Serializable; + import java.util.Map; /** *************** *** 41,44 **** --- 42,47 ---- private String credentials; + private Map advancedProperties; + private boolean autoConnect; *************** *** 63,67 **** new java.io.ObjectStreamField("libraryURI", java.lang.String.class), new java.io.ObjectStreamField("principal", java.lang.String.class), ! new java.io.ObjectStreamField("serverUrl", java.lang.String.class)}; --- 66,71 ---- new java.io.ObjectStreamField("libraryURI", java.lang.String.class), new java.io.ObjectStreamField("principal", java.lang.String.class), ! new java.io.ObjectStreamField("serverUrl", java.lang.String.class), ! new java.io.ObjectStreamField("advancedProperties", Map.class)}; *************** *** 266,268 **** --- 270,279 ---- } + public Map getAdvancedProperties() { + return advancedProperties; + } + + public void setAdvancedProperties(Map advancedProperties) { + this.advancedProperties = advancedProperties; + } } |
From: Greg H. <gh...@us...> - 2004-05-26 03:03:03
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/connection In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21720/src/org/mc4j/console/connection Modified Files: JSR160ConnectionNode.java Log Message: Support for arbitrary additional connection properties. Currently only works with JSR160 connections. RFE #951493. Index: JSR160ConnectionNode.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/connection/JSR160ConnectionNode.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** JSR160ConnectionNode.java 21 Apr 2004 20:38:46 -0000 1.9 --- JSR160ConnectionNode.java 26 May 2004 03:02:50 -0000 1.10 *************** *** 28,31 **** --- 28,33 ---- import java.net.ConnectException; import java.util.HashMap; + import java.util.Iterator; + import java.util.Map; import javax.management.MBeanServer; *************** *** 69,72 **** --- 71,86 ---- } + // Set and custom, advanced properties + if (connectionSettings.getAdvancedProperties() != null) { + for (Iterator iterator = connectionSettings.getAdvancedProperties().entrySet().iterator(); iterator.hasNext();) { + Map.Entry entry = (Map.Entry) iterator.next(); + String key = (String) entry.getKey(); + String value = (String) entry.getValue(); + + env.put(key, value); + } + } + + // Set the credential String[] credentials = new String[] { |
From: Greg H. <gh...@us...> - 2004-05-26 03:03:03
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/connection/wizard/advanced In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21720/src/org/mc4j/console/connection/wizard/advanced Added Files: AdvancedPanel.form AdvancedPanel.java Log Message: Support for arbitrary additional connection properties. Currently only works with JSR160 connections. RFE #951493. --- NEW FILE: AdvancedPanel.java --- /* * AdvancedPanel.java * * Created on May 17, 2004, 1:31 PM */ package org.mc4j.console.connection.wizard.advanced; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Vector; import javax.swing.table.DefaultTableModel; /** * * @author Administrator */ public class AdvancedPanel extends javax.swing.JPanel { /** Creates new form AdvancedPanel */ public AdvancedPanel(Map properties) { initComponents(); if (properties != null) { setProperties(properties); } } private void setProperties(Map properties) { DefaultTableModel model = (DefaultTableModel) this.propertyTable.getModel(); for (Iterator iterator = properties.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); String key = (String) entry.getKey(); String value = (String) entry.getValue(); Vector row = new Vector(); row.add(key); row.add(value); model.addRow(row); } } public Map getProperties() { Map properties = new HashMap(); DefaultTableModel model = (DefaultTableModel) this.propertyTable.getModel(); Vector data = model.getDataVector(); for (Iterator iterator = data.iterator(); iterator.hasNext();) { Vector vector = (Vector) iterator.next(); String key = (String) vector.get(0); String value = (String) vector.get(0); properties.put(key, value); } return properties; } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ private void initComponents() {//GEN-BEGIN:initComponents java.awt.GridBagConstraints gridBagConstraints; borderLayout1 = new java.awt.BorderLayout(); infoLabel = new javax.swing.JLabel(); propertyTableScrollPane = new javax.swing.JScrollPane(); propertyTable = new javax.swing.JTable(); rightButtonPanel = new javax.swing.JPanel(); addButton = new javax.swing.JButton(); removeButton = new javax.swing.JButton(); setLayout(new java.awt.GridBagLayout()); infoLabel.setText("Add new connection properties here..."); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(8, 8, 8, 8); add(infoLabel, gridBagConstraints); propertyTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "Name", "Value" } ) { Class[] types = new Class [] { java.lang.String.class, java.lang.String.class }; public Class getColumnClass(int columnIndex) { return types [columnIndex]; } }); propertyTableScrollPane.setViewportView(propertyTable); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); add(propertyTableScrollPane, gridBagConstraints); rightButtonPanel.setLayout(new java.awt.GridBagLayout()); addButton.setText("Add"); addButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { addButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); rightButtonPanel.add(addButton, gridBagConstraints); removeButton.setText("Remove"); removeButton.setEnabled(false); removeButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { removeButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); rightButtonPanel.add(removeButton, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; add(rightButtonPanel, gridBagConstraints); }//GEN-END:initComponents private void removeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeButtonActionPerformed int rowSelection = this.propertyTable.getSelectedRow(); DefaultTableModel model = (DefaultTableModel) this.propertyTable.getModel(); model.removeRow(rowSelection); }//GEN-LAST:event_removeButtonActionPerformed private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addButtonActionPerformed DefaultTableModel model = (DefaultTableModel) this.propertyTable.getModel(); model.addRow(new Object[] { "", "" }); }//GEN-LAST:event_addButtonActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton addButton; private java.awt.BorderLayout borderLayout1; private javax.swing.JLabel infoLabel; private javax.swing.JTable propertyTable; private javax.swing.JScrollPane propertyTableScrollPane; private javax.swing.JButton removeButton; private javax.swing.JPanel rightButtonPanel; // End of variables declaration//GEN-END:variables } --- NEW FILE: AdvancedPanel.form --- <?xml version="1.0" encoding="UTF-8" ?> <Form version="1.0" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <NonVisualComponents> <Component class="java.awt.BorderLayout" name="borderLayout1"> </Component> </NonVisualComponents> <AuxValues> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-77"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JLabel" name="infoLabel"> <Properties> <Property name="text" type="java.lang.String" value="Add new connection properties here..."/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="8" insetsLeft="8" insetsBottom="8" insetsRight="8" anchor="10" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Container class="javax.swing.JScrollPane" name="propertyTableScrollPane"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="2" fill="1" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="5" insetsBottom="5" insetsRight="5" anchor="10" weightX="1.0" weightY="1.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> <SubComponents> <Component class="javax.swing.JTable" name="propertyTable"> <Properties> <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor"> <Table columnCount="2" rowCount="0"> <Column editable="true" title="Name" type="java.lang.String"/> <Column editable="true" title="Value" type="java.lang.String"/> </Table> </Property> </Properties> </Component> </SubComponents> </Container> <Container class="javax.swing.JPanel" name="rightButtonPanel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JButton" name="addButton"> <Properties> <Property name="text" type="java.lang.String" value="Add"/> </Properties> <Events> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addButtonActionPerformed"/> </Events> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="4" insetsBottom="4" insetsRight="4" anchor="10" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JButton" name="removeButton"> <Properties> <Property name="text" type="java.lang.String" value="Remove"/> <Property name="enabled" type="boolean" value="false"/> </Properties> <Events> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="removeButtonActionPerformed"/> </Events> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="4" insetsBottom="4" insetsRight="4" anchor="10" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Container> </SubComponents> </Form> |
From: Greg H. <gh...@us...> - 2004-05-26 03:03:03
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/connection/wizard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21720/src/org/mc4j/console/connection/wizard Modified Files: ConnectionVisualPanel.form ConnectionVisualPanel.java Log Message: Support for arbitrary additional connection properties. Currently only works with JSR160 connections. RFE #951493. Index: ConnectionVisualPanel.form =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/connection/wizard/ConnectionVisualPanel.form,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ConnectionVisualPanel.form 21 Apr 2004 20:38:21 -0000 1.5 --- ConnectionVisualPanel.form 26 May 2004 03:02:50 -0000 1.6 *************** *** 182,185 **** --- 182,198 ---- </Constraints> </Component> + <Component class="javax.swing.JButton" name="advancedButton"> + <Properties> + <Property name="text" type="java.lang.String" value="Advanced..."/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="advancedButtonActionPerformed"/> + </Events> + <Constraints> + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> + <GridBagConstraints gridX="1" gridY="7" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="14" weightX="0.0" weightY="0.0"/> + </Constraint> + </Constraints> + </Component> </SubComponents> </Form> Index: ConnectionVisualPanel.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/connection/wizard/ConnectionVisualPanel.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ConnectionVisualPanel.java 21 Apr 2004 20:38:28 -0000 1.15 --- ConnectionVisualPanel.java 26 May 2004 03:02:50 -0000 1.16 *************** *** 20,23 **** --- 20,26 ---- package org.mc4j.console.connection.wizard; + import org.openide.DialogDescriptor; + import org.openide.DialogDisplayer; + import org.openide.ErrorManager; import org.openide.WizardDescriptor; import org.openide.util.HelpCtx; *************** *** 26,32 **** import org.mc4j.console.IConnectionNode; import org.mc4j.console.ManagementNode; import org.mc4j.console.swing.ComponentBorder; ! import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; --- 29,39 ---- import org.mc4j.console.IConnectionNode; import org.mc4j.console.ManagementNode; + import org.mc4j.console.connection.persistence.ConnectionSettings; + import org.mc4j.console.connection.wizard.advanced.AdvancedPanel; import org.mc4j.console.swing.ComponentBorder; ! import java.awt.Color; ! import java.awt.Component; ! import java.awt.Dialog; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; *************** *** 35,41 **** import java.util.HashSet; import java.util.Iterator; import java.util.Set; ! import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; --- 42,50 ---- import java.util.HashSet; import java.util.Iterator; + import java.util.Map; import java.util.Set; ! import javax.swing.JComboBox; ! import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; *************** *** 59,62 **** --- 68,73 ---- private final ConnectionDescriptor connectionDescriptor; + private Map advancedProperties; + *************** *** 143,153 **** public void update() { ! this.connectionDescriptor.getSettings().setConnectionType((String) ((JComboBox)getTitledComponent()).getSelectedItem()); ! this.connectionDescriptor.getSettings().setConnectionName(this.nameField.getText()); ! this.connectionDescriptor.getSettings().setJndiName(this.jndiNameField.getText()); ! this.connectionDescriptor.getSettings().setInitialContextName(this.initialContextFactoryComboBox.getSelectedItem().toString()); ! this.connectionDescriptor.getSettings().setServerUrl(this.serverURLComboBox.getSelectedItem().toString()); ! this.connectionDescriptor.getSettings().setPrincipal(this.principleField.getText()); ! this.connectionDescriptor.getSettings().setCredentials(this.credentialsField.getText()); } --- 154,167 ---- public void update() { ! ConnectionSettings settings = this.connectionDescriptor.getSettings(); ! settings.setConnectionType((String) ((JComboBox)getTitledComponent()).getSelectedItem()); ! settings.setConnectionName(this.nameField.getText()); ! settings.setJndiName(this.jndiNameField.getText()); ! settings.setInitialContextName(this.initialContextFactoryComboBox.getSelectedItem().toString()); ! settings.setServerUrl(this.serverURLComboBox.getSelectedItem().toString()); ! settings.setPrincipal(this.principleField.getText()); ! settings.setCredentials(this.credentialsField.getText()); ! settings.setAdvancedProperties(this.advancedProperties); ! settings.setAdvancedProperties(this.advancedProperties); } *************** *** 226,229 **** --- 240,244 ---- jndiNameField = new javax.swing.JTextField(); messageLabel = new javax.swing.JTextArea(); + advancedButton = new javax.swing.JButton(); setLayout(new java.awt.GridBagLayout()); *************** *** 233,239 **** gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; - gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.weighty = 1.0; add(initialContextFactoryLabel, gridBagConstraints); --- 248,254 ---- gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.weighty = 1.0; + gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); add(initialContextFactoryLabel, gridBagConstraints); *************** *** 248,255 **** gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; add(initialContextFactoryComboBox, gridBagConstraints); --- 263,270 ---- gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; + gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); add(initialContextFactoryComboBox, gridBagConstraints); *************** *** 258,263 **** gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; - gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; add(serverUrlLabel, gridBagConstraints); --- 273,278 ---- gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); add(serverUrlLabel, gridBagConstraints); *************** *** 271,278 **** gridBagConstraints.gridy = 4; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; add(serverURLComboBox, gridBagConstraints); --- 286,293 ---- gridBagConstraints.gridy = 4; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; + gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); add(serverURLComboBox, gridBagConstraints); *************** *** 281,286 **** gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; - gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; add(principleLabel, gridBagConstraints); --- 296,301 ---- gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); add(principleLabel, gridBagConstraints); *************** *** 289,295 **** gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 6; - gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.weighty = 0.2; add(credentialsLabel, gridBagConstraints); --- 304,310 ---- gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 6; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.weighty = 0.2; + gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); add(credentialsLabel, gridBagConstraints); *************** *** 298,305 **** gridBagConstraints.gridy = 5; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; add(principleField, gridBagConstraints); --- 313,320 ---- gridBagConstraints.gridy = 5; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; + gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); add(principleField, gridBagConstraints); *************** *** 308,315 **** gridBagConstraints.gridy = 6; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; add(credentialsField, gridBagConstraints); --- 323,330 ---- gridBagConstraints.gridy = 6; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; + gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); add(credentialsField, gridBagConstraints); *************** *** 324,331 **** gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; add(nameField, gridBagConstraints); --- 339,346 ---- gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; + gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); add(nameField, gridBagConstraints); *************** *** 334,339 **** gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; - gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; add(nameLabel, gridBagConstraints); --- 349,354 ---- gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); add(nameLabel, gridBagConstraints); *************** *** 342,347 **** gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; - gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; add(jndiNameLabel, gridBagConstraints); --- 357,362 ---- gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); add(jndiNameLabel, gridBagConstraints); *************** *** 351,358 **** gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; add(jndiNameField, gridBagConstraints); --- 366,373 ---- gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; + gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); add(jndiNameField, gridBagConstraints); *************** *** 370,375 **** --- 385,426 ---- add(messageLabel, gridBagConstraints); + advancedButton.setText("Advanced..."); + advancedButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + advancedButtonActionPerformed(evt); + } + }); + + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 7; + gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHEAST; + add(advancedButton, gridBagConstraints); + }//GEN-END:initComponents + private void advancedButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_advancedButtonActionPerformed + AdvancedPanel panel = new AdvancedPanel(this.advancedProperties); + + DialogDescriptor descriptor = new DialogDescriptor(panel, "Advanced connection properties"); + + final Dialog dialog = DialogDisplayer.getDefault().createDialog(descriptor); + + try { + dialog.setVisible(true); + } catch (Exception e) { // InterruptedException, InvocationTargetException + ErrorManager.getDefault().notify(e); + return; + } + + if (descriptor.getValue() == WizardDescriptor.FINISH_OPTION) { + + System.out.println("OK'ed the advanced props"); + this.advancedProperties = panel.getProperties(); + } + + + }//GEN-LAST:event_advancedButtonActionPerformed + private void fireChangeEvent(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_fireChangeEvent // Add your handling code here: *************** *** 382,385 **** --- 433,437 ---- // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton advancedButton; private javax.swing.JTextField credentialsField; private javax.swing.JLabel credentialsLabel; |
From: Greg H. <gh...@us...> - 2004-05-26 02:52:16
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/connection/wizard/advanced In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20178/src/org/mc4j/console/connection/wizard/advanced Log Message: Directory /cvsroot/mc4j/mc4j/src/org/mc4j/console/connection/wizard/advanced added to the repository |
From: Greg H. <gh...@us...> - 2004-05-26 02:51:32
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20039/src/org/mc4j/console/dashboard Modified Files: Dashboard.java DashboardFactory.java Log Message: Fix for bugs #939971, #914838, #957714, #933080 Based on patches submitted by holbitlan. Now removes mbeans from the tree when they are unregistered from the server. This is based on the 10 second, delayed refresh thread. (Not removing beans from dashboard attribute table components on unregister yet as this can cause problems depending on the dashboard match section) Index: DashboardFactory.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard/DashboardFactory.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** DashboardFactory.java 8 May 2004 03:53:00 -0000 1.12 --- DashboardFactory.java 26 May 2004 02:51:22 -0000 1.13 *************** *** 153,158 **** context.put(Dashboard.CONTEXT_DASHBOARD_ROOT_CONTAINER, contentPanel); context.put(Dashboard.CONTEXT_DASHBOARD_NAME, dashboard.getDisplayName()); ! ! --- 153,157 ---- context.put(Dashboard.CONTEXT_DASHBOARD_ROOT_CONTAINER, contentPanel); context.put(Dashboard.CONTEXT_DASHBOARD_NAME, dashboard.getDisplayName()); ! context.put(Dashboard.CONTEXT_DASHBOARD, dashboard); Index: Dashboard.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard/Dashboard.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Dashboard.java 8 Apr 2004 20:30:43 -0000 1.14 --- Dashboard.java 26 May 2004 02:51:22 -0000 1.15 *************** *** 20,25 **** package org.mc4j.console.dashboard; ! import java.util.HashMap; ! import java.util.Map; import org.mc4j.console.bean.MBeanNode; --- 20,24 ---- package org.mc4j.console.dashboard; ! import org.w3c.dom.Document; import org.mc4j.console.bean.MBeanNode; *************** *** 27,31 **** import org.mc4j.console.dashboard.match.MatchExecutor; ! import org.w3c.dom.Document; /** --- 26,31 ---- import org.mc4j.console.dashboard.match.MatchExecutor; ! import java.util.HashMap; ! import java.util.Map; /** *************** *** 64,67 **** --- 64,68 ---- public static final String CONTEXT_MBEAN_SERVER ="MBeanServer"; public static final String CONTEXT_OBJECT_NAME = "ObjectName"; + public static final String CONTEXT_DASHBOARD = "Dashboard"; public static final String CONTEXT_DASHBOARD_ROOT_CONTAINER = "DashboardRootContainer"; public static final String CONTEXT_DASHBOARD_NAME = "DashboardName"; |
From: Greg H. <gh...@us...> - 2004-05-26 02:51:32
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/domain In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20039/src/org/mc4j/console/domain Modified Files: DomainNode.java Log Message: Fix for bugs #939971, #914838, #957714, #933080 Based on patches submitted by holbitlan. Now removes mbeans from the tree when they are unregistered from the server. This is based on the 10 second, delayed refresh thread. (Not removing beans from dashboard attribute table components on unregister yet as this can cause problems depending on the dashboard match section) Index: DomainNode.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/domain/DomainNode.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** DomainNode.java 7 Apr 2004 15:27:37 -0000 1.8 --- DomainNode.java 26 May 2004 02:51:23 -0000 1.9 *************** *** 20,23 **** --- 20,32 ---- package org.mc4j.console.domain; + import org.openide.nodes.AbstractNode; + import org.openide.nodes.Node; + import org.openide.util.HelpCtx; + import org.openide.util.actions.NodeAction; + import org.openide.util.actions.SystemAction; + + import org.mc4j.console.bean.MBeanNode; + import org.mc4j.console.install.ExplorerUtil; + import java.util.ArrayList; import java.util.Collections; *************** *** 34,46 **** import javax.management.ObjectName; - import org.openide.nodes.AbstractNode; - import org.openide.nodes.Node; - import org.openide.util.HelpCtx; - import org.openide.util.actions.NodeAction; - import org.openide.util.actions.SystemAction; - - import org.mc4j.console.bean.MBeanNode; - import org.mc4j.console.install.ExplorerUtil; - /** * --- 43,46 ---- *************** *** 50,53 **** --- 50,55 ---- public class DomainNode extends AbstractNode implements Comparable { + private static final Object groupLock = new Object(); + String domainName; *************** *** 218,257 **** public void setGroupTypes(boolean groupTypes) { ! if (this.groupTypes == groupTypes) { ! return; ! } ! this.groupTypes = groupTypes; ! if (this.groupTypes) { ! Node[] childrenArr = getChildren().getNodes(); ! // Remove them from this node first ! this.getChildren().remove(childrenArr); ! List children = new ArrayList(); ! for (int i = 0; i < childrenArr.length; i++) { ! Node node = childrenArr[i]; ! children.add(node); ! } ! distributeNode(children, this, new HashSet()); ! } else { ! List childNodes = aggregateNode(this, new ArrayList()); ! Node[] childNodeArray = new Node[childNodes.size()]; ! for (int i = 0; i < childNodes.size(); i++) { ! MBeanNode beanNode = (MBeanNode) childNodes.get(i); ! childNodeArray[i] = beanNode; } ! getChildren().add(childNodeArray); } } public void refresh() { this.updateNodeCount(); if (ExplorerUtil.isExpanded(this)) { Node[] children = getChildren().getNodes(); --- 220,308 ---- public void setGroupTypes(boolean groupTypes) { ! // grouping modifies the domain structure massively -> other actions have to wait for the result ! synchronized (groupLock) { ! if (this.groupTypes == groupTypes) { ! return; ! } ! this.groupTypes = groupTypes; ! if (this.groupTypes) { ! Node[] childrenArr = getChildren().getNodes(); ! // Remove them from this node first ! this.getChildren().remove(childrenArr); ! List children = new ArrayList(); ! for (int i = 0; i < childrenArr.length; i++) { ! Node node = childrenArr[i]; ! children.add(node); ! } ! distributeNode(children, this, new HashSet()); ! } else { ! List childNodes = aggregateNode(this, new ArrayList()); ! Node[] childNodeArray = new Node[childNodes.size()]; ! for (int i = 0; i < childNodes.size(); i++) { ! MBeanNode beanNode = (MBeanNode) childNodes.get(i); ! childNodeArray[i] = beanNode; ! } ! ! getChildren().add(childNodeArray); } + } + } ! /** ! * Removes obsolete child-nodes. ! * <p>A node is considered obsolete, if ! * <ul><li>it is a <code>MBeanNode</code> and the corresponding MBean is not anymore registered in the MBeanServer</li> ! * <li>it is a <code>DomainNode</code> without children</li></ul></p> ! */ ! private void removeUnregisteredNodes() { ! // don't remove any nodes while (un)grouping is in process ! synchronized (groupLock) { ! Node[] children = getChildren().getNodes(); ! ArrayList nodesToRemove = new ArrayList(); ! for (int i = 0; i < children.length; i++) { ! if (children[i] instanceof MBeanNode) { ! MBeanNode currentMBeanNode = ((MBeanNode)children[i]); ! ! if (!currentMBeanNode.isRegistered()) { ! // the mbean is not any more registered in the mbean server ! nodesToRemove.add(currentMBeanNode); ! } ! } else if (children[i] instanceof DomainNode) { ! DomainNode currentDomainNode = ((DomainNode)children[i]); ! ! // recursively remove unregistered nodes in the domain node ! currentDomainNode.removeUnregisteredNodes(); ! ! // if the domain node has no children left, remove it, too ! if (0 == currentDomainNode.getChildren().getNodes().length) { ! nodesToRemove.add(currentDomainNode); ! } ! } ! } ! ! if (nodesToRemove.size() > 0) { ! Node[] removeArray = (Node[]) nodesToRemove.toArray(new Node[nodesToRemove.size()]); ! this.getChildren().remove(removeArray); ! } } } public void refresh() { + // remove all unregistered (child-)mbean nodes (even if not expanded!) + // Doing this elsewhere + // this.removeUnregisteredNodes(); + + // update the node count this.updateNodeCount(); + + // refresh if expanded if (ExplorerUtil.isExpanded(this)) { Node[] children = getChildren().getNodes(); *************** *** 259,263 **** if (children[i] instanceof MBeanNode) { ! ((MBeanNode)children[i]).refresh(); } else if (children[i] instanceof DomainNode) { ((DomainNode)children[i]).refresh(); --- 310,314 ---- if (children[i] instanceof MBeanNode) { ! ((MBeanNode)children[i]).refresh(); } else if (children[i] instanceof DomainNode) { ((DomainNode)children[i]).refresh(); |
From: Greg H. <gh...@us...> - 2004-05-26 02:51:32
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/connection In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20039/src/org/mc4j/console/connection Modified Files: ConnectionNode.java Log Message: Fix for bugs #939971, #914838, #957714, #933080 Based on patches submitted by holbitlan. Now removes mbeans from the tree when they are unregistered from the server. This is based on the 10 second, delayed refresh thread. (Not removing beans from dashboard attribute table components on unregister yet as this can cause problems depending on the dashboard match section) Index: ConnectionNode.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/connection/ConnectionNode.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** ConnectionNode.java 21 Apr 2004 20:38:38 -0000 1.28 --- ConnectionNode.java 26 May 2004 02:51:22 -0000 1.29 *************** *** 20,45 **** package org.mc4j.console.connection; - import java.beans.IntrospectionException; - import java.beans.PropertyChangeEvent; - import java.beans.PropertyChangeListener; - import java.io.IOException; - import java.util.ArrayList; - import java.util.Collections; - import java.util.HashMap; - import java.util.HashSet; - import java.util.Iterator; - import java.util.List; - import java.util.Map; - import java.util.Set; - import java.util.SortedSet; - import java.util.Timer; - import java.util.TimerTask; - import java.util.TreeSet; - - import javax.management.MBeanServer; - import javax.management.ObjectInstance; - import javax.management.ObjectName; - import javax.swing.SwingUtilities; - import org.openide.ErrorManager; import org.openide.actions.OpenLocalExplorerAction; --- 20,23 ---- *************** *** 67,71 **** import org.mc4j.console.query.NewQueryAction; ! import EDU.oswego.cs.dl.util.concurrent.PooledExecutor; /** --- 45,69 ---- import org.mc4j.console.query.NewQueryAction; ! import java.beans.IntrospectionException; ! import java.beans.PropertyChangeEvent; ! import java.beans.PropertyChangeListener; ! import java.io.IOException; ! import java.util.ArrayList; ! import java.util.Collections; ! import java.util.HashMap; ! import java.util.HashSet; ! import java.util.Iterator; ! import java.util.List; ! import java.util.Map; ! import java.util.Set; ! import java.util.SortedSet; ! import java.util.Timer; ! import java.util.TimerTask; ! import java.util.TreeSet; ! ! import javax.management.MBeanServer; ! import javax.management.ObjectInstance; ! import javax.management.ObjectName; ! import javax.swing.SwingUtilities; /** *************** *** 87,91 **** /** Holds a map of ObjectNames.getCannonicalName() to MBeanNodes */ ! protected Map mbeans = new HashMap(); protected Node.PropertySet[] settingsPropertySets; --- 85,89 ---- /** Holds a map of ObjectNames.getCannonicalName() to MBeanNodes */ ! protected volatile Map mbeans = new HashMap(); protected Node.PropertySet[] settingsPropertySets; *************** *** 93,97 **** private Timer refreshTimer; ! private PooledExecutor remoteExecutor; private Set openDashboards = new HashSet(); --- 91,95 ---- private Timer refreshTimer; ! //private PooledExecutor remoteExecutor; private Set openDashboards = new HashSet(); *************** *** 101,106 **** // Setup a working pool of up to 5 threads to process remote calls ! remoteExecutor = new PooledExecutor(5); ! remoteExecutor.waitWhenBlocked(); // Set self on domain nodes so they can alert us when someone expands us --- 99,104 ---- // Setup a working pool of up to 5 threads to process remote calls ! //remoteExecutor = new PooledExecutor(5); ! //remoteExecutor.waitWhenBlocked(); // Set self on domain nodes so they can alert us when someone expands us *************** *** 114,124 **** } ! /** ! * Provides access to the remote executor used to make calls to the remote server... ! * @return The pooled executor for this connection ! */ ! public PooledExecutor getExecutor() { ! return this.remoteExecutor; ! } public void propertyChange(PropertyChangeEvent evt) { --- 112,122 ---- } ! // /** ! // * Provides access to the remote executor used to make calls to the remote server... ! // * @return The pooled executor for this connection ! // */ ! // public PooledExecutor getExecutor() { ! // return this.remoteExecutor; ! // } public void propertyChange(PropertyChangeEvent evt) { *************** *** 199,210 **** } ! Iterator iter = sortedObjectNames.iterator(); int i = 0; ! while (iter.hasNext()) { ObjectName objectName = (ObjectName) iter.next(); ! if ((this.mbeans == null) || (!this.mbeans.containsKey(objectName.getCanonicalName()))) { ! //org.openide.windows.IOProvider.getDefault().getStdOut().println("Mount MBean: " + objectInstance.getObjectName().getCanonicalName()); ! addMBean(objectName); } --- 197,216 ---- } ! // Create a secondary set that will be winowed with beans ! // that are still registered. Beans left in this set at the end ! // have been deregistered. ! HashSet oldMBeans = new HashSet(mbeans.keySet()); ! int i = 0; ! for (Iterator iter = sortedObjectNames.iterator(); iter.hasNext();) { ObjectName objectName = (ObjectName) iter.next(); ! synchronized(this) { ! if ((this.mbeans == null) || (!this.mbeans.containsKey(objectName.getCanonicalName()))) { ! //org.openide.windows.IOProvider.getDefault().getStdOut().println("Mount MBean: " + objectInstance.getObjectName().getCanonicalName()); ! addMBean(objectName); ! } else { ! oldMBeans.remove(objectName.getCanonicalName()); ! } } *************** *** 214,226 **** + "] " + i + " of " + objectNames.size()); } - // Don't refresh here, this.refresh already starts the chain of refreshes - /* else { - // refresh the existing one - //MBeanNode node = (MBeanNode) this.mbeans.get(objectInstance.getObjectName().getCanonicalName()); - //node.refresh(); - } - */ } } catch (Exception e) { StatusDisplayer.getDefault().setStatusText("Problem contacting server: " + --- 220,236 ---- + "] " + i + " of " + objectNames.size()); } } + // Clean out beans that have been unregistered + for (Iterator it = oldMBeans.iterator(); it.hasNext();) { + String mbeansKey = (String) it.next(); + + MBeanNode node = (MBeanNode) this.mbeans.get(mbeansKey); + node.getParentNode().getChildren().remove(new Node[] { node }); + + mbeans.remove(mbeansKey); + + } + } catch (Exception e) { StatusDisplayer.getDefault().setStatusText("Problem contacting server: " + *************** *** 238,259 **** */ protected void addMBean(ObjectInstance objectInstance) { ! this.addMBean(objectInstance.getObjectName()); } protected void addMBean(ObjectName objectName) { ! String domain = objectName.getDomain(); ! ! DomainNode domainNode = (DomainNode) this.getChildren().findChild(domain); ! if (domainNode == null) { ! domainNode = new DomainNode(domain); ! this.getChildren().add(new Node[] { domainNode }); ! } ! MBeanNode mbeanNode = new MBeanNode(objectName, this); ! this.mbeans.put(objectName.getCanonicalName(), mbeanNode); ! domainNode.getChildren().add( ! new Node[] { mbeanNode }); } --- 248,272 ---- */ protected void addMBean(ObjectInstance objectInstance) { ! synchronized(this) { ! this.addMBean(objectInstance.getObjectName()); ! } } protected void addMBean(ObjectName objectName) { + synchronized(this) { + String domain = objectName.getDomain(); ! DomainNode domainNode = (DomainNode) this.getChildren().findChild(domain); ! if (domainNode == null) { ! domainNode = new DomainNode(domain); ! this.getChildren().add(new Node[] { domainNode }); ! } ! MBeanNode mbeanNode = new MBeanNode(objectName, this); ! this.mbeans.put(objectName.getCanonicalName(), mbeanNode); ! domainNode.getChildren().add( ! new Node[] { mbeanNode }); ! } } *************** *** 419,423 **** // Kill any outstanding requests ! this.remoteExecutor.shutdownNow(); setIconBase("org/mc4j/console/connection/DisconnectedConnectionNodeIcon"); --- 432,436 ---- // Kill any outstanding requests ! //this.remoteExecutor.shutdownNow(); setIconBase("org/mc4j/console/connection/DisconnectedConnectionNodeIcon"); *************** *** 488,494 **** public void browseToMBean(final ObjectName objectName) { ! final String name = objectName.getCanonicalName(); ! ! final MBeanNode node = (MBeanNode) this.mbeans.get(name); if (node != null) { ExplorerUtil.browseTo(node); --- 501,505 ---- public void browseToMBean(final ObjectName objectName) { ! final MBeanNode node = getMBeanNode(objectName); if (node != null) { ExplorerUtil.browseTo(node); |
From: Greg H. <gh...@us...> - 2004-05-26 02:51:32
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard/components In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20039/src/org/mc4j/console/dashboard/components Modified Files: AttributeTableComponent.java Log Message: Fix for bugs #939971, #914838, #957714, #933080 Based on patches submitted by holbitlan. Now removes mbeans from the tree when they are unregistered from the server. This is based on the 10 second, delayed refresh thread. (Not removing beans from dashboard attribute table components on unregister yet as this can cause problems depending on the dashboard match section) Index: AttributeTableComponent.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard/components/AttributeTableComponent.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AttributeTableComponent.java 7 Apr 2004 02:56:39 -0000 1.5 --- AttributeTableComponent.java 26 May 2004 02:51:22 -0000 1.6 *************** *** 20,23 **** --- 20,30 ---- package org.mc4j.console.dashboard.components; + import org.mc4j.console.bean.MBeanNode; + import org.mc4j.console.bean.attribute.AttributeNode; + import org.mc4j.console.connection.ConnectionNode; + import org.mc4j.console.dashboard.Dashboard; + import org.mc4j.console.swing.table.TableMap; + import org.mc4j.console.swing.table.TableSorter; + import java.awt.BorderLayout; import java.awt.Color; *************** *** 25,28 **** --- 32,36 ---- import java.awt.Font; import java.util.ArrayList; + import java.util.Arrays; import java.util.Iterator; import java.util.List; *************** *** 42,53 **** import javax.swing.table.TableModel; - import org.mc4j.console.Refreshable; - import org.mc4j.console.bean.MBeanNode; - import org.mc4j.console.bean.attribute.AttributeNode; - import org.mc4j.console.dashboard.Dashboard; - import org.mc4j.console.dashboard.DashboardComponent; - import org.mc4j.console.swing.table.TableMap; - import org.mc4j.console.swing.table.TableSorter; - /** * --- 50,53 ---- *************** *** 56,60 **** */ public class AttributeTableComponent extends JPanel implements BeanListComponent, Runnable { ! protected List attributeNames = new ArrayList(); --- 56,60 ---- */ public class AttributeTableComponent extends JPanel implements BeanListComponent, Runnable { ! protected List attributeNames = new ArrayList(); *************** *** 85,89 **** ! public void init() { this.removeAll(); --- 85,93 ---- ! private Dashboard dashboard; ! ! private ConnectionNode connectionNode; ! ! public void init() { this.removeAll(); *************** *** 130,168 **** public void refresh() { ! if (this.tableModel instanceof AttributeTableModel) ! ((AttributeTableModel)this.tableModel).resetChangeList(); int row = 0; for (Iterator iterator = mbeanNodes.iterator(); iterator.hasNext();) { MBeanNode beanNode = (MBeanNode) iterator.next(); - beanNode.retrieveData(); - Map attributeNodeMap = beanNode.getAttributeNodeMap(); ! int col = 0; ! for (Iterator iterator1 = attributeNames.iterator(); iterator1.hasNext();) { ! String attributeName = (String) iterator1.next(); ! AttributeNode node = (AttributeNode) attributeNodeMap.get(attributeName); ! Object value = null; ! if (node != null) { ! value = node.getValue(); ! } else { ! value = beanNode.getObjectName().getKeyProperty(attributeName); ! if (value == null) ! value = "unknown"; ! } ! if (!this.sorted) { ! this.tableModel.setColumnClass(col, (value!=null)?value.getClass():Object.class); ! } ! if ((value != null) && !value.equals(this.tableModel.getValueAt(row,col))) ! this.tableModel.setValueAt(value, row, col); ! col++; } - if (!this.sorted) - this.sorted = true; - row++; } this.tableModel.fireTableDataChanged(); --- 134,207 ---- public void refresh() { + + if (this.tableModel instanceof AttributeTableModel) + ((AttributeTableModel)this.tableModel).resetChangeList(); ! // TODO GH: FIX! Here we are going to try and re-execute the original dashboard ! // match in order to see if there are any new beans available. ! // An interesting idea, but a bit dangerous as we can't be sure which ! // bean match we're lined up with. The Bean Matcher should support ! // a change listener model. ! /* ! List matchedDashboards = (null != this.dashboard && null != this.connectionNode) ? MatchExecutor.getInstance().matchGlobalDashboards(this.dashboard, this.connectionNode) : null; ! ! if (null != matchedDashboards) { ! // very much magic here: ! // - BeanMatchList(0) contains the id of the match list ! // - the contextStarter contains the list of mbeanNodes under that id ! ! List mbeanList = (List) dashboard.getContextStarter().get(((BeanMatch) dashboard.getDashboardMatch().getBeanMatchList().get(0)).getId()); ! ! for (Iterator it = mbeanList.iterator(); it.hasNext();) { ! MBeanNode beanNode = (MBeanNode) it.next(); ! ! // TODO this is not very performing: we are searching a List. Change into HashSet?? ! if (!mbeanNodes.contains(beanNode)) { ! // add the new MBean ! mbeanNodes.add(beanNode); ! tableModel.incrementRowCount(); ! } ! } ! } ! */ int row = 0; for (Iterator iterator = mbeanNodes.iterator(); iterator.hasNext();) { MBeanNode beanNode = (MBeanNode) iterator.next(); ! if (beanNode.isRegistered()) { ! beanNode.retrieveData(); ! Map attributeNodeMap = beanNode.getAttributeNodeMap(); ! int col = 0; ! for (Iterator iterator1 = attributeNames.iterator(); iterator1.hasNext();) { ! String attributeName = (String) iterator1.next(); ! AttributeNode node = (AttributeNode) attributeNodeMap.get(attributeName); ! Object value = null; ! if (node != null) { ! value = node.getValue(); ! } else { ! value = beanNode.getObjectName().getKeyProperty(attributeName); ! if (value == null) ! value = "unknown"; ! } ! if (!this.sorted) { ! this.tableModel.setColumnClass(col, (value!=null)?value.getClass():Object.class); ! } ! if ((value != null) && !value.equals(this.tableModel.getValueAt(row,col))) ! this.tableModel.setValueAt(value, row, col); ! ! col++; + } + if (!this.sorted) + this.sorted = true; + row++; + } else { + // the MBean of the current node is not any longer registered inside the MBeanServer -> remove it from the list + this.tableModel.removeRow(row); + iterator.remove(); } } this.tableModel.fireTableDataChanged(); *************** *** 236,243 **** --- 275,324 ---- } + + /** + * Adapts the internal changes array and then calls {@link DefaultTableModel#removeRow(int)}. + */ + public void removeRow(int row) { + int rowCount = getRowCount(); + int columnCount = getColumnCount(); + boolean[][] newChanges = new boolean[rowCount-1][columnCount]; + + if ( 0 < row ) { + System.arraycopy(this.changes, 0, newChanges, 0, row); + } + if ( (row + 1) < rowCount ) { + System.arraycopy(this.changes, row+1, newChanges, row, rowCount-row-1); + } + + changes = newChanges; + + super.removeRow(row); + } + + /** + * Adapts the internal changes array and then calls {@link DefaultTableModel#setRowCount(int)}. + */ + public void incrementRowCount() { + int rowCount = getRowCount(); + int columnCount = getColumnCount(); + boolean[][] newChanges = new boolean[rowCount+1][columnCount]; + + System.arraycopy(this.changes, 0, newChanges, 0, rowCount); + Arrays.fill(newChanges[rowCount], true); + + this.changes = newChanges; + + super.setRowCount(rowCount+1); + } + } public void setBeanList(List list) { this.mbeanNodes = list; + + if (!list.isEmpty()) { + // this assumes that all mbean are from the same connection + connectionNode = ((MBeanNode) list.get(0)).getConnectionNode(); + } } *************** *** 248,252 **** "AttributeTableComponent: You must specify an appropriate [beanList] attribute."); } ! init(); } --- 329,336 ---- "AttributeTableComponent: You must specify an appropriate [beanList] attribute."); } ! ! dashboard = (Dashboard) context.get(Dashboard.CONTEXT_DASHBOARD); ! ! init(); } |