[Mc4j-cvs] mc4j/src/org/mc4j/console/dashboard/components BeanComponent.java,NONE,1.1 BeanListCompon
Brought to you by:
ghinkl
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard/components In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15665/src/org/mc4j/console/dashboard/components Modified Files: AttributeListComponent.java AttributeTableComponent.java AttributeTreeTableExplorer.java MBeanTreeComponent.java NumericAttributeGaugeMeter.java NumericAttributeGraph.java NumericAttributeMeter.java OperationListComponent.java RefreshControlComponent.java RelationsGraphComponent.java RelationsGraphComponent3.java RelationsGraphComponent4.java Added Files: BeanComponent.java BeanListComponent.java Log Message: Components updated to have their matches set rather than searching the context programatically. Index: AttributeTableComponent.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard/components/AttributeTableComponent.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AttributeTableComponent.java 17 Feb 2004 02:05:06 -0000 1.4 --- AttributeTableComponent.java 7 Apr 2004 02:56:39 -0000 1.5 *************** *** 55,59 **** * @version $Revision$($Author$ / $Date$) */ ! public class AttributeTableComponent extends JPanel implements DashboardComponent, Runnable, Refreshable { protected List attributeNames = new ArrayList(); --- 55,59 ---- * @version $Revision$($Author$ / $Date$) */ ! public class AttributeTableComponent extends JPanel implements BeanListComponent, Runnable { protected List attributeNames = new ArrayList(); *************** *** 238,245 **** } public void setContext(Map context) { ! this.mbeanNodes = (List) context.get(Dashboard.CONTEXT_MBEAN_LIST); init(); } --- 238,251 ---- } + public void setBeanList(List list) { + this.mbeanNodes = list; + } public void setContext(Map context) { ! if (this.mbeanNodes == null) { ! throw new IllegalStateException( ! "AttributeTableComponent: You must specify an appropriate [beanList] attribute."); ! } init(); } Index: NumericAttributeMeter.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard/components/NumericAttributeMeter.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** NumericAttributeMeter.java 7 Feb 2004 16:10:41 -0000 1.9 --- NumericAttributeMeter.java 7 Apr 2004 02:56:39 -0000 1.10 *************** *** 37,45 **** * @version $Revision$($Author$ / $Date$) */ ! public class NumericAttributeMeter extends TopComponent implements Runnable, DashboardComponent { private MBeanServer server; private ObjectName objectName; private String currentAttributeName; --- 37,47 ---- * @version $Revision$($Author$ / $Date$) */ ! public class NumericAttributeMeter extends TopComponent implements Runnable, BeanComponent { private MBeanServer server; private ObjectName objectName; + private MBeanNode beanNode; + private String currentAttributeName; *************** *** 99,108 **** } public void setContext(Map context) { ! MBeanNode node = (MBeanNode) context.get("MBeanNode"); ! this.server = node.getMBeanServer(); ! this.objectName = node.getObjectName(); Thread updater = new Thread(this, "mc4j NumericAttributeMeter Updater"); --- 101,116 ---- } + public void setBeanNode(MBeanNode node) { + this.beanNode = node; + } public void setContext(Map context) { ! if (this.beanNode == null) { ! throw new IllegalStateException( ! "NumericAttributeMeter: context atribute [beanNode] not set."); ! } ! this.server = this.beanNode.getMBeanServer(); ! this.objectName = this.beanNode.getObjectName(); Thread updater = new Thread(this, "mc4j NumericAttributeMeter Updater"); Index: OperationListComponent.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard/components/OperationListComponent.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** OperationListComponent.java 7 Feb 2004 16:10:41 -0000 1.6 --- OperationListComponent.java 7 Apr 2004 02:56:39 -0000 1.7 *************** *** 54,58 **** * @version $Revision$($Author$ / $Date$) */ ! public class OperationListComponent extends JPanel implements DashboardComponent { public static final int BUTTON_ONLY_FORMAT = 1; --- 54,58 ---- * @version $Revision$($Author$ / $Date$) */ ! public class OperationListComponent extends JPanel implements BeanComponent { public static final int BUTTON_ONLY_FORMAT = 1; *************** *** 68,72 **** private Set operationNames = new HashSet(); ! private MBeanNode mbeanNode; private int format = FULL_FORMAT; --- 68,72 ---- private Set operationNames = new HashSet(); ! private MBeanNode beanNode; private int format = FULL_FORMAT; *************** *** 102,106 **** this.setOpaque(false); ! Set operSet = this.mbeanNode.getOperationNodeMap().entrySet(); Iterator operIter = operSet.iterator(); int row = 1; --- 102,106 ---- this.setOpaque(false); ! Set operSet = this.beanNode.getOperationNodeMap().entrySet(); Iterator operIter = operSet.iterator(); int row = 1; *************** *** 205,217 **** executor.start(); } - - public void setContext(Map context) { - if (this.objectName == null) { - this.mbeanNode = (MBeanNode) context.get(Dashboard.CONTEXT_MBEAN_NODE); ! } else { ! ConnectionNode connectionNode = (ConnectionNode) context.get(Dashboard.CONTEXT_CONNECTION_NODE); ! this.mbeanNode = connectionNode.getMBeanNode(this.objectName); } refresh(); --- 205,217 ---- executor.start(); } ! public void setBeanNode(MBeanNode node) { ! this.beanNode = node; ! } ! public void setContext(Map context) { ! if (this.beanNode == null) { ! throw new IllegalStateException( ! "OperationListComponent: context atribute [beanNode] not set."); } refresh(); Index: RelationsGraphComponent.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard/components/RelationsGraphComponent.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RelationsGraphComponent.java 7 Feb 2004 16:10:41 -0000 1.4 --- RelationsGraphComponent.java 7 Apr 2004 02:56:39 -0000 1.5 *************** *** 59,63 **** */ public class RelationsGraphComponent ! extends DashboardTopComponent implements DashboardComponent { protected JGraph graph; --- 59,63 ---- */ public class RelationsGraphComponent ! extends DashboardTopComponent implements BeanComponent { protected JGraph graph; *************** *** 73,84 **** } ! public void setContext(Map context) { ! if (this.objectName == null) { ! this.mbeanNode = (MBeanNode) context.get(Dashboard.CONTEXT_MBEAN_NODE); ! ! } else { ! ConnectionNode connectionNode = (ConnectionNode) context.get(Dashboard.CONTEXT_CONNECTION_NODE); ! this.mbeanNode = connectionNode.getMBeanNode(this.objectName); } refresh(); --- 73,84 ---- } ! public void setBeanNode(MBeanNode node) { ! this.mbeanNode = node; ! } ! public void setContext(Map context) { ! if (this.mbeanNode == null) { ! throw new IllegalStateException( ! "RelationsGraphComponent: attribute [beanNode] must be provided with a relationship service bean."); } refresh(); Index: RefreshControlComponent.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard/components/RefreshControlComponent.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RefreshControlComponent.java 19 Feb 2004 19:31:42 -0000 1.3 --- RefreshControlComponent.java 7 Apr 2004 02:56:39 -0000 1.4 *************** *** 177,181 **** } } ! if (container instanceof Refreshable) { ((Refreshable)container).refresh(); } --- 177,182 ---- } } ! if (container instanceof Refreshable && ! !(container instanceof RefreshControlComponent)) { ((Refreshable)container).refresh(); } Index: NumericAttributeGraph.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard/components/NumericAttributeGraph.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** NumericAttributeGraph.java 3 Mar 2004 23:05:19 -0000 1.11 --- NumericAttributeGraph.java 7 Apr 2004 02:56:39 -0000 1.12 *************** *** 39,46 **** * @version $Revision$($Author$ / $Date$) */ ! public class NumericAttributeGraph extends AttributeGraphPanel implements DashboardComponent { protected Set attributeSet = new HashSet(); /* --- 39,47 ---- * @version $Revision$($Author$ / $Date$) */ ! public class NumericAttributeGraph extends AttributeGraphPanel implements BeanComponent { protected Set attributeSet = new HashSet(); + protected MBeanNode node; /* *************** *** 91,98 **** } public void setContext(Map context) { ! MBeanNode node = (MBeanNode) context.get("MBeanNode"); ! ObjectName objectName = node.getObjectName(); MBeanAttributeInfo[] completeAttributeInfo = node.getMBeanInfo().getAttributes(); --- 92,107 ---- } + public void setBeanNode(MBeanNode mBeanNode) { + this.node = mBeanNode; + } + public void setContext(Map context) { ! ! if (node == null) { ! throw new IllegalStateException( ! "NumericAttributeGraph: context atribute [beanNode] not set."); ! } ! ObjectName objectName = node.getObjectName(); MBeanAttributeInfo[] completeAttributeInfo = node.getMBeanInfo().getAttributes(); *************** *** 116,199 **** reschedule(); - /* - DateAxis domain = new DateAxis("Time"); - NumberAxis range = new NumberAxis(""); - - - this.xyplot = new XYPlot(dataset, domain, range, new DefaultXYItemRenderer()); - domain.setAutoRange(true); - domain.setLowerMargin(0.0); - domain.setUpperMargin(0.0); - domain.setTickLabelsVisible(true); - - range.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); - - JFreeChart chart = - new JFreeChart( - "", - JFreeChart.DEFAULT_TITLE_FONT, - xyplot, - true); - - chart.setTitle( - new TextTitle("Graph: " + this.objectName.getCanonicalName(), - new Font("SansSerif",Font.BOLD, 12))); - - // Don't anti-alias - chart.setAntiAlias(false); - - ChartPanel chartPanel = new ChartPanel(chart,false,true,true,false,false); - //chartPanel.setPopupMenu(null); - chartPanel.setOpaque(false); - chart.setBackgroundPaint(this.getBackground()); - chartPanel.setBackground(this.getBackground()); - //chartPanel.setBorder(new LineBorder(Color.BLACK,1)); - add(chartPanel); - - this.dataGenerator = new DataGenerator(); - this.dataGenerator.start(); - */ - } - - /* - public void addObservation(String attributeName) { - try { - Object value = this.server.getAttribute(this.objectName, attributeName); - Number val = (Number) value; - - TimeSeries ts = (TimeSeries) this.timeSeriesMap.get(attributeName); - ts.add(new Millisecond(), val.doubleValue()); - failures--; - } catch (Exception e) { - failures++; - org.openide.windows.IOProvider.getDefault().getStdOut().println(e); - } - if (failures > MAX_FAILURES) { - this.dataGenerator.stop(); - } } - */ - - - /* - class DataGenerator extends Timer implements ActionListener { - - DataGenerator() { - super(200, null); - addActionListener(this); - } - - - public void actionPerformed(ActionEvent event) { - Iterator iter = timeSeriesMap.keySet().iterator(); - while (iter.hasNext()) { - addObservation((String)iter.next()); - } - - int sleep = sleepSlider.getValue(); - this.setDelay(sleep); - } - } - */ } --- 125,129 ---- --- NEW FILE: BeanComponent.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.console.dashboard.components; import org.mc4j.console.bean.MBeanNode; import org.mc4j.console.dashboard.DashboardComponent; /** * Implemenations of this type of dashboard component are designed to display * or control only a single bean and are designed to work with the "Single" type * of BeanMatch. * * @author Greg Hinkle (gh...@us...), Apr 6, 2004 * @version $Revision: 1.1 $($Author: ghinkl $ / $Date: 2004/04/07 02:56:39 $) */ public interface BeanComponent extends DashboardComponent { void setBeanNode(MBeanNode node); } --- NEW FILE: BeanListComponent.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.console.dashboard.components; import java.util.List; import org.mc4j.console.dashboard.DashboardComponent; /** * Implementations of this type of dashboard component are meant to provide * displays of lists of beans and are linked to the "Multiple" type of * BeanMatch. * * @author Greg Hinkle (gh...@us...), Apr 6, 2004 * @version $Revision: 1.1 $($Author: ghinkl $ / $Date: 2004/04/07 02:56:39 $) */ public interface BeanListComponent extends DashboardComponent { /** * Used to specify the list of beans that will be used by a component * for display. * @param beanList */ void setBeanList(List beanList); } Index: RelationsGraphComponent3.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard/components/RelationsGraphComponent3.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RelationsGraphComponent3.java 7 Feb 2004 16:10:41 -0000 1.3 --- RelationsGraphComponent3.java 7 Apr 2004 02:56:39 -0000 1.4 *************** *** 37,40 **** --- 37,41 ---- import org.openide.ErrorManager; + import org.openide.nodes.BeanNode; import org.mc4j.console.bean.MBeanNode; *************** *** 56,60 **** */ public class RelationsGraphComponent3 ! extends GLPanel implements DashboardComponent { protected ObjectName objectName; --- 57,61 ---- */ public class RelationsGraphComponent3 ! extends GLPanel implements BeanComponent { protected ObjectName objectName; *************** *** 103,119 **** ! ! ! public void setContext(Map context) { ! if (this.objectName == null) { ! this.mbeanNode = (MBeanNode) context.get(Dashboard.CONTEXT_MBEAN_NODE); ! ! } else { ! ConnectionNode connectionNode = (ConnectionNode) context.get(Dashboard.CONTEXT_CONNECTION_NODE); ! ! this.mbeanNode = connectionNode.getMBeanNode(this.objectName); } refresh(); --- 104,116 ---- ! public void setBeanNode(MBeanNode node) { ! this.mbeanNode = node; ! } public void setContext(Map context) { ! if (this.mbeanNode == null) { ! throw new IllegalStateException( ! "RelationsGraphComponent3: attribute [beanNode] must be provided with a valid Relation service bean."); } refresh(); Index: AttributeTreeTableExplorer.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard/components/AttributeTreeTableExplorer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AttributeTreeTableExplorer.java 2 Apr 2004 03:32:38 -0000 1.1 --- AttributeTreeTableExplorer.java 7 Apr 2004 02:56:39 -0000 1.2 *************** *** 48,52 **** */ public class AttributeTreeTableExplorer extends TopComponent ! implements DashboardComponent, Refreshable, ExplorerManager.Provider, Lookup.Provider { private ExplorerManager manager; --- 48,52 ---- */ public class AttributeTreeTableExplorer extends TopComponent ! implements BeanComponent, ExplorerManager.Provider, Lookup.Provider { private ExplorerManager manager; *************** *** 121,128 **** } public void setContext(Map context) { ! this.beanNode = (MBeanNode) context.get(Dashboard.CONTEXT_MBEAN_NODE); createComponents(); --- 121,134 ---- } + public void setBeanNode(MBeanNode node) { + this.beanNode = node; + } public void setContext(Map context) { ! if (this.beanNode == null) { ! throw new IllegalStateException( ! "AttributeTreeTableExplorer: context atribute [beanNode] not set."); ! } createComponents(); Index: NumericAttributeGaugeMeter.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard/components/NumericAttributeGaugeMeter.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** NumericAttributeGaugeMeter.java 7 Feb 2004 16:10:41 -0000 1.6 --- NumericAttributeGaugeMeter.java 7 Apr 2004 02:56:39 -0000 1.7 *************** *** 47,55 **** * @version $Revision$($Author$ / $Date$) */ ! public class NumericAttributeGaugeMeter extends TopComponent implements Runnable, DashboardComponent { private MBeanServer server; private ObjectName objectName; private String currentAttributeName; --- 47,57 ---- * @version $Revision$($Author$ / $Date$) */ ! public class NumericAttributeGaugeMeter extends TopComponent implements BeanComponent, Runnable { private MBeanServer server; private ObjectName objectName; + private MBeanNode beanNode; + private String currentAttributeName; *************** *** 166,175 **** } public void setContext(Map context) { ! MBeanNode node = (MBeanNode) context.get("MBeanNode"); ! this.server = node.getMBeanServer(); ! this.objectName = node.getObjectName(); Thread updater = new Thread(this, "mc4j NumericAttributeGauge Updater"); --- 168,183 ---- } + public void setBeanNode(MBeanNode node) { + this.beanNode = node; + } public void setContext(Map context) { ! if (this.beanNode == null) { ! throw new IllegalStateException( ! "NumericAttributeGaugeMeter: context atribute [beanNode] not set."); ! } ! this.server = this.beanNode.getMBeanServer(); ! this.objectName = this.beanNode.getObjectName(); Thread updater = new Thread(this, "mc4j NumericAttributeGauge Updater"); Index: RelationsGraphComponent4.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard/components/RelationsGraphComponent4.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RelationsGraphComponent4.java 7 Feb 2004 16:10:41 -0000 1.2 --- RelationsGraphComponent4.java 7 Apr 2004 02:56:39 -0000 1.3 *************** *** 25,31 **** import org.mc4j.console.dashboard.DashboardComponent; import org.mc4j.console.dashboard.DashboardTopComponent; ! ! public class RelationsGraphComponent4 extends DashboardTopComponent implements DashboardComponent { RelationsGraphComponent3 g; --- 25,32 ---- import org.mc4j.console.dashboard.DashboardComponent; import org.mc4j.console.dashboard.DashboardTopComponent; + import org.mc4j.console.bean.MBeanNode; ! // TODO GH - These relationship components need to be cleaned up ! public class RelationsGraphComponent4 extends DashboardTopComponent implements BeanComponent { RelationsGraphComponent3 g; *************** *** 40,43 **** --- 41,48 ---- + public void setBeanNode(MBeanNode node) { + g.setBeanNode(node); + } + public void setContext(Map context) { g.setContext(context); Index: AttributeListComponent.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard/components/AttributeListComponent.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AttributeListComponent.java 7 Feb 2004 16:10:41 -0000 1.5 --- AttributeListComponent.java 7 Apr 2004 02:56:39 -0000 1.6 *************** *** 41,45 **** * @version $Revision$($Author$ / $Date$) */ ! public class AttributeListComponent extends JPanel implements DashboardComponent { Set nodeNames = new HashSet(); --- 41,45 ---- * @version $Revision$($Author$ / $Date$) */ ! public class AttributeListComponent extends JPanel implements BeanComponent { Set nodeNames = new HashSet(); *************** *** 123,129 **** return valueLabel; } ! public void setContext(Map context) { ! this.mbeanNode = (MBeanNode) context.get("MBeanNode"); refresh(); } --- 123,138 ---- return valueLabel; } ! ! public void setBeanNode(MBeanNode node) { ! this.mbeanNode = node; ! } ! ! ! public void setContext(Map context) { ! if (this.mbeanNode == null) { ! throw new IllegalStateException( ! "AttributeListComponent: context atribute [beanNode] not set."); ! } refresh(); } Index: MBeanTreeComponent.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard/components/MBeanTreeComponent.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** MBeanTreeComponent.java 7 Feb 2004 16:10:41 -0000 1.5 --- MBeanTreeComponent.java 7 Apr 2004 02:56:39 -0000 1.6 *************** *** 20,23 **** --- 20,25 ---- package org.mc4j.console.dashboard.components; + import org.openide.windows.IOProvider; + import org.mc4j.console.bean.MBeanNode; import org.mc4j.console.swing.ExtendedExplorerPanel; *************** *** 39,43 **** node.getChildren(); ! org.openide.windows.IOProvider.getDefault().getStdOut().println("Node: " + node.getDisplayName()); getExplorerManager().setRootContext(node); --- 41,45 ---- node.getChildren(); ! IOProvider.getDefault().getIO("Dashboard debugging",false).getOut().println("Node: " + node.getDisplayName()); getExplorerManager().setRootContext(node); |