http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/012fad7c/attic/apps/ds-console/console/containers/AdvancedPanel.as ---------------------------------------------------------------------- diff --git a/attic/apps/ds-console/console/containers/AdvancedPanel.as b/attic/apps/ds-console/console/containers/AdvancedPanel.as index 5b73f3c..9140987 100755 --- a/attic/apps/ds-console/console/containers/AdvancedPanel.as +++ b/attic/apps/ds-console/console/containers/AdvancedPanel.as @@ -1,169 +1,169 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package console.containers -{ - import console.ConsoleManager; - import console.containers.*; - import console.events.*; - import mx.collections.ListCollectionView; - import mx.rpc.events.ResultEvent; - import mx.messaging.management.MBeanInfo; - import mx.messaging.management.MBeanAttributeInfo; - import mx.events.*; - import mx.controls.Tree; - import mx.controls.DataGrid; - import flash.events.Event; - import flash.events.MouseEvent; - import mx.containers.Box; - - public class AdvancedPanel extends UpdateListener - { - private var display:AdvancedPanelDisplay; - private var _manager:ConsoleManager; - private var _currentMBeanName:String; - private var _currentMBeanInfo:MBeanInfo; - - public function AdvancedPanel():void - { - super(); - initialize(); - - percentWidth = 100; - percentHeight = 100; - - display = new AdvancedPanelDisplay(); - this.addChild(display); - - label = "Generic Administration View"; - - display.mbeanTree.addEventListener(ListEvent.CHANGE, manageMBean); - display.attributeGrid.addEventListener(ListEvent.CHANGE, showSelectedValue); - display.refreshButton.addEventListener(MouseEvent.CLICK, handleRefreshClick); - display.operationsUI.tabnav = display.main; - - _manager = ConsoleManager.getInstance(); - _manager.registerListener(this, []); - display.operationsUI.addEventListener(ManagementOperationInvokeEvent.INVOKE, _manager.invokeOperation); - } - - public override function mbeanModelUpdate(model:Object):void - { - display.mbeanTree.dataProvider = model; - } - - /** - * Exposes a selected MBean for management. - */ - private function manageMBean(e:Event):void - { - var node:Object = display.mbeanTree.selectedItem; - if (node && node.hasOwnProperty("objectName")) - { - _currentMBeanName = node["objectName"].canonicalName; - display.mbeanNameText.text = _currentMBeanName; - _manager.getMBeanInfo(_currentMBeanName, this, handleMBeanInfo); - } - } - - /** - * Handles the result of getMBeanInfo(). - */ - public function handleMBeanInfo(e:ResultEvent):void - { - _currentMBeanInfo = MBeanInfo(e.result); - // Update string descriptions for the selected MBean. - display.mbeanClassText.text = _currentMBeanInfo.className; - display.mbeanDescriptionText.text = _currentMBeanInfo.description; - display.mbeanInfoOutput.text = _currentMBeanInfo.toString(); - // Update the Operations tab. - display.operationsUI.mbeanInfo = _currentMBeanInfo; - display.operationsUI.mbeanName = _currentMBeanName; - // Fetch current attribute values for the selected MBean. - // Clear out currently selected attribute value. - display.selectedValueText.text = ""; - - if (_currentMBeanInfo.attributes.length) - { - _manager.getAllAttributes(_currentMBeanName, _currentMBeanInfo, this, handleAttributes); - } - } - - /** - * Handles the refresh button click. - */ - private function handleRefreshClick(event:MouseEvent):void - { - refreshAttributes(); - } - - /** - * Refreshes the displayed attribute values for the currently selected MBean. - */ - private function refreshAttributes():void - { - if (_currentMBeanInfo != null) - { - _manager.getAllAttributes(_currentMBeanName, _currentMBeanInfo, this, handleAttributes); - } - } - - /** - * Handles the result of getAttributes(). - */ - private function handleAttributes(e:ResultEvent):void - { - var attribs:Array = e.result as Array; - var attribLength:int = attribs.length; - display.attributeGrid.dataProvider = e.result; - // Show selected item value. - var index:int = display.attributeGrid.selectedIndex; - if (index != -1) - { - var item:Object = ListCollectionView(display.attributeGrid.dataProvider).getItemAt(index); - if ((item != null) && (item.value != null)) - { - display.selectedValueText.text = item.value.toString(); - } - } - else - { - display.selectedValueText.text = ""; - } - } - - - /** - * Hack function to show the selected grid value - we should get rid of this with - * a nice attributes grid that renders values nicely in a selectable fashion. - */ - private function showSelectedValue(e:Event):void - { - var value:Object = DataGrid(e.target).selectedItem.value; - if (value != null) - { - display.selectedValueText.text = value.toString(); - } - else - { - display.selectedValueText.text = "null"; - } - } - - } +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package console.containers +{ + import console.ConsoleManager; + import console.containers.*; + import console.events.*; + import mx.collections.ListCollectionView; + import mx.rpc.events.ResultEvent; + import mx.messaging.management.MBeanInfo; + import mx.messaging.management.MBeanAttributeInfo; + import mx.events.*; + import mx.controls.Tree; + import mx.controls.DataGrid; + import flash.events.Event; + import flash.events.MouseEvent; + import mx.containers.Box; + + public class AdvancedPanel extends UpdateListener + { + private var display:AdvancedPanelDisplay; + private var _manager:ConsoleManager; + private var _currentMBeanName:String; + private var _currentMBeanInfo:MBeanInfo; + + public function AdvancedPanel():void + { + super(); + initialize(); + + percentWidth = 100; + percentHeight = 100; + + display = new AdvancedPanelDisplay(); + this.addChild(display); + + label = "Generic Administration View"; + + display.mbeanTree.addEventListener(ListEvent.CHANGE, manageMBean); + display.attributeGrid.addEventListener(ListEvent.CHANGE, showSelectedValue); + display.refreshButton.addEventListener(MouseEvent.CLICK, handleRefreshClick); + display.operationsUI.tabnav = display.main; + + _manager = ConsoleManager.getInstance(); + _manager.registerListener(this, []); + display.operationsUI.addEventListener(ManagementOperationInvokeEvent.INVOKE, _manager.invokeOperation); + } + + public override function mbeanModelUpdate(model:Object):void + { + display.mbeanTree.dataProvider = model; + } + + /** + * Exposes a selected MBean for management. + */ + private function manageMBean(e:Event):void + { + var node:Object = display.mbeanTree.selectedItem; + if (node && node.hasOwnProperty("objectName")) + { + _currentMBeanName = node["objectName"].canonicalName; + display.mbeanNameText.text = _currentMBeanName; + _manager.getMBeanInfo(_currentMBeanName, this, handleMBeanInfo); + } + } + + /** + * Handles the result of getMBeanInfo(). + */ + public function handleMBeanInfo(e:ResultEvent):void + { + _currentMBeanInfo = MBeanInfo(e.result); + // Update string descriptions for the selected MBean. + display.mbeanClassText.text = _currentMBeanInfo.className; + display.mbeanDescriptionText.text = _currentMBeanInfo.description; + display.mbeanInfoOutput.text = _currentMBeanInfo.toString(); + // Update the Operations tab. + display.operationsUI.mbeanInfo = _currentMBeanInfo; + display.operationsUI.mbeanName = _currentMBeanName; + // Fetch current attribute values for the selected MBean. + // Clear out currently selected attribute value. + display.selectedValueText.text = ""; + + if (_currentMBeanInfo.attributes.length) + { + _manager.getAllAttributes(_currentMBeanName, _currentMBeanInfo, this, handleAttributes); + } + } + + /** + * Handles the refresh button click. + */ + private function handleRefreshClick(event:MouseEvent):void + { + refreshAttributes(); + } + + /** + * Refreshes the displayed attribute values for the currently selected MBean. + */ + private function refreshAttributes():void + { + if (_currentMBeanInfo != null) + { + _manager.getAllAttributes(_currentMBeanName, _currentMBeanInfo, this, handleAttributes); + } + } + + /** + * Handles the result of getAttributes(). + */ + private function handleAttributes(e:ResultEvent):void + { + var attribs:Array = e.result as Array; + var attribLength:int = attribs.length; + display.attributeGrid.dataProvider = e.result; + // Show selected item value. + var index:int = display.attributeGrid.selectedIndex; + if (index != -1) + { + var item:Object = ListCollectionView(display.attributeGrid.dataProvider).getItemAt(index); + if ((item != null) && (item.value != null)) + { + display.selectedValueText.text = item.value.toString(); + } + } + else + { + display.selectedValueText.text = ""; + } + } + + + /** + * Hack function to show the selected grid value - we should get rid of this with + * a nice attributes grid that renders values nicely in a selectable fashion. + */ + private function showSelectedValue(e:Event):void + { + var value:Object = DataGrid(e.target).selectedItem.value; + if (value != null) + { + display.selectedValueText.text = value.toString(); + } + else + { + display.selectedValueText.text = "null"; + } + } + + } } \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/012fad7c/attic/apps/ds-console/console/containers/AdvancedPanelDisplay.mxml ---------------------------------------------------------------------- diff --git a/attic/apps/ds-console/console/containers/AdvancedPanelDisplay.mxml b/attic/apps/ds-console/console/containers/AdvancedPanelDisplay.mxml index 8db15cb..213e4a3 100755 --- a/attic/apps/ds-console/console/containers/AdvancedPanelDisplay.mxml +++ b/attic/apps/ds-console/console/containers/AdvancedPanelDisplay.mxml @@ -1,69 +1,69 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ---> -<mx:Box xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:console="console.containers.*" xmlns="*" width="100%" height="100%"> - - <mx:HDividedBox width="100%" height="100%"> - - <mx:VBox height="100%" width="300"> - <mx:Label text="MBeans"/> - <mx:Tree id="mbeanTree" height="100%" width="100%" /> - </mx:VBox> - - <mx:VBox id="mbeanDetails" height="100%" width="100%"> - - <mx:HBox width="100%"> - <mx:Label text="Name: "/> - <mx:Text id="mbeanNameText" width="100%" selectable="true"/> - </mx:HBox> - - <mx:TabNavigator id="main" creationPolicy="all" width="100%" height="100%" tabWidth="150"> - - <mx:VBox label="Attributes" width="100%" height="100%"> - <mx:HBox width="100%"> - <mx:Label text="Selected Value: "/> - <mx:Text id="selectedValueText" text="" width="100%" selectable="true" /> - </mx:HBox> - <mx:DataGrid id="attributeGrid" width="100%" height="100%" /> - <mx:Button label="Refresh" id="refreshButton" /> - </mx:VBox> - - <mx:VBox label="Operations" id="operationTab" width="100%" height="100%"> - <console:OperationSet id="operationsUI" /> - </mx:VBox> - - <mx:VBox label="Info" width="100%" height="100%" > - <mx:HBox width="100%"> - <mx:Label text="MBean Class:"/> - <mx:Text id="mbeanClassText" width="100%" selectable="true"/> - </mx:HBox> - <mx:HBox width="100%"> - <mx:Label text="Description:" /> - <mx:Text id="mbeanDescriptionText" width="100%" selectable="true"/> - </mx:HBox> - <mx:TextArea id="mbeanInfoOutput" height="100%" width="100%"/> - </mx:VBox> - - </mx:TabNavigator> - - </mx:VBox> - - </mx:HDividedBox> - -</mx:Box> +<?xml version="1.0" encoding="utf-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<mx:Box xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:console="console.containers.*" xmlns="*" width="100%" height="100%"> + + <mx:HDividedBox width="100%" height="100%"> + + <mx:VBox height="100%" width="300"> + <mx:Label text="MBeans"/> + <mx:Tree id="mbeanTree" height="100%" width="100%" /> + </mx:VBox> + + <mx:VBox id="mbeanDetails" height="100%" width="100%"> + + <mx:HBox width="100%"> + <mx:Label text="Name: "/> + <mx:Text id="mbeanNameText" width="100%" selectable="true"/> + </mx:HBox> + + <mx:TabNavigator id="main" creationPolicy="all" width="100%" height="100%" tabWidth="150"> + + <mx:VBox label="Attributes" width="100%" height="100%"> + <mx:HBox width="100%"> + <mx:Label text="Selected Value: "/> + <mx:Text id="selectedValueText" text="" width="100%" selectable="true" /> + </mx:HBox> + <mx:DataGrid id="attributeGrid" width="100%" height="100%" /> + <mx:Button label="Refresh" id="refreshButton" /> + </mx:VBox> + + <mx:VBox label="Operations" id="operationTab" width="100%" height="100%"> + <console:OperationSet id="operationsUI" /> + </mx:VBox> + + <mx:VBox label="Info" width="100%" height="100%" > + <mx:HBox width="100%"> + <mx:Label text="MBean Class:"/> + <mx:Text id="mbeanClassText" width="100%" selectable="true"/> + </mx:HBox> + <mx:HBox width="100%"> + <mx:Label text="Description:" /> + <mx:Text id="mbeanDescriptionText" width="100%" selectable="true"/> + </mx:HBox> + <mx:TextArea id="mbeanInfoOutput" height="100%" width="100%"/> + </mx:VBox> + + </mx:TabNavigator> + + </mx:VBox> + + </mx:HDividedBox> + +</mx:Box> http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/012fad7c/attic/apps/ds-console/console/containers/DefaultPanel.as ---------------------------------------------------------------------- diff --git a/attic/apps/ds-console/console/containers/DefaultPanel.as b/attic/apps/ds-console/console/containers/DefaultPanel.as index 43b4408..9b3bf0c 100755 --- a/attic/apps/ds-console/console/containers/DefaultPanel.as +++ b/attic/apps/ds-console/console/containers/DefaultPanel.as @@ -1,41 +1,41 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package console.containers -{ - import console.ConsoleManager; - import mx.containers.Panel; - import flash.events.Event; - - public class DefaultPanel extends UpdateListener - { - private var display:DefaultPanelDisplay; - - public function DefaultPanel():void - { - super(); - display = new DefaultPanelDisplay; - this.addChild(display); - label = "Console"; - - // No data is ever used, but to ensure compatibility with the rest of - // the app this panel still registers with the ConsoleManager - ConsoleManager.getInstance().registerListener(this, []); - } - } +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package console.containers +{ + import console.ConsoleManager; + import mx.containers.Panel; + import flash.events.Event; + + public class DefaultPanel extends UpdateListener + { + private var display:DefaultPanelDisplay; + + public function DefaultPanel():void + { + super(); + display = new DefaultPanelDisplay; + this.addChild(display); + label = "Console"; + + // No data is ever used, but to ensure compatibility with the rest of + // the app this panel still registers with the ConsoleManager + ConsoleManager.getInstance().registerListener(this, []); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/012fad7c/attic/apps/ds-console/console/containers/DefaultPanelDisplay.mxml ---------------------------------------------------------------------- diff --git a/attic/apps/ds-console/console/containers/DefaultPanelDisplay.mxml b/attic/apps/ds-console/console/containers/DefaultPanelDisplay.mxml index 4088270..16b3bea 100755 --- a/attic/apps/ds-console/console/containers/DefaultPanelDisplay.mxml +++ b/attic/apps/ds-console/console/containers/DefaultPanelDisplay.mxml @@ -1,29 +1,29 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ---> -<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"> - <mx:TextArea width="100%" height="20%" editable="false" enabled="true" fontSize="12" paddingLeft="10" paddingRight="10"> - <mx:htmlText> - <![CDATA[ - <font size="18">Welcome to the <strong>Administration Console</font><br /> - Get started by choosing a panel in the tab navigation above.<br /> - ]]> - </mx:htmlText> - </mx:TextArea> -</mx:VBox> +<?xml version="1.0" encoding="utf-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"> + <mx:TextArea width="100%" height="20%" editable="false" enabled="true" fontSize="12" paddingLeft="10" paddingRight="10"> + <mx:htmlText> + <![CDATA[ + <font size="18">Welcome to the <strong>Administration Console</font><br /> + Get started by choosing a panel in the tab navigation above.<br /> + ]]> + </mx:htmlText> + </mx:TextArea> +</mx:VBox> http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/012fad7c/attic/apps/ds-console/console/containers/DestinationManager.as ---------------------------------------------------------------------- diff --git a/attic/apps/ds-console/console/containers/DestinationManager.as b/attic/apps/ds-console/console/containers/DestinationManager.as index 323406e..71ca7bc 100755 --- a/attic/apps/ds-console/console/containers/DestinationManager.as +++ b/attic/apps/ds-console/console/containers/DestinationManager.as @@ -1,238 +1,238 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package console.containers -{ - import console.data.Bindable3DHashMap; - import console.ConsoleManager; - import mx.collections.ArrayCollection; - import mx.events.ListEvent; - import flash.events.Event; - import mx.charts.LineChart; - import mx.charts.series.LineSeries; - import mx.controls.listClasses.ListBase; - import mx.events.CollectionEvent; - - public class DestinationManager extends UpdateListener - { - private static const pollableTypes:Array = [ - ConsoleManager.DESTINATION_POLLABLE ]; - - private var _manager:ConsoleManager; - private var display:DestinationManagerDisplay; - private var selectedDestinationId:String; - private var selectedMBean:String; - private var dataCache:Bindable3DHashMap; - private var pollableAttributes:Object; - - [Bindable] - private var selectedBeanProperties:ArrayCollection; - - [Bindable] - private var selectedPropertyValues:ArrayCollection; - - public override function dataUpdate(type:int, data:Object):void - { - var dataArray:ArrayCollection = new ArrayCollection; - - // This finds any exposed properties under any destination node and - // adds them to the proper data structures so that all data in MBeans - // underneath destinations can be accesed by the destination's id - for (var name:String in data) - { - var mapKey:String; - var mapValue:String; - - // Gets all properties for this MBean - var propertyArrayForMBean:Array = data[name]; - - // split the mbean name on the commas, then split on the periods and get the last - // type. if it contains destination, insert it into the array - // otherwise find the destination tag and insert it into it's data cache key. - var mbeanNames:Array = name.split(","); - - // find the actual type of this MBean, and if it is a Destination, we can use the id - // as the map key, otherwise, we have to find the MBean's parent which is a Destination - var types:Array = (mbeanNames[mbeanNames.length - 1] as String).split("."); - if ((types[types.length - 1] as String).indexOf("Destination") >= 0) - { - // we are going after the id pairing here, most often it will be the second - // to last pair but since WAS 6.1 inserts nodes and servers into - // the MBean name it may not be the case. For optimization we'll still - // go after the second to last pair, but will verify that this is indeed - // the id pair and if not will look for it explicitly. - var namePair:Array = (mbeanNames[mbeanNames.length - 2] as String).split("="); - - mapKey = namePair[0]; - mapValue = namePair[1]; - if (mapKey != "id") - { - // did not find id where expected go through entire name pair collection - // looking for the id pair - for each (var mbeanNamePair:String in mbeanNames) - { - var loopNamePair:Array = mbeanNamePair.split("="); - mapKey =loopNamePair[0]; - mapValue = loopNamePair[1]; - if (mapKey == "id") - { - break; - } - } - } - } - else - { - for each (var id:String in mbeanNames) - { - if (id.indexOf("Destination") >= 0) - { - // Get the Destination's id name as the key into the map - mapValue = id.split("=")[1]; - break; - } - } - } - - // For each property, add the property and value to the appropriate map - for (var i:int = 0; i < propertyArrayForMBean.length; i++) - { - if (pollableTypes.indexOf(type) >= 0) - dataCache.update(mapValue, propertyArrayForMBean[i].name, propertyArrayForMBean[i].value); - else - dataCache.updateNoPollable(mapValue, propertyArrayForMBean[i].name, propertyArrayForMBean[i].value) - } - } - } - - public override function mbeanModelUpdate(model:Object):void - { - refreshDestinations(); - } - - public function DestinationManager():void - { - super(); - display = new DestinationManagerDisplay; - this.addChild(display); - - this.label = "Destination Management"; - - _manager = ConsoleManager.getInstance(); - var registerTypes:Array = [ - {type: ConsoleManager.DESTINATION_GENERAL, poll: false}, - {type: ConsoleManager.DESTINATION_POLLABLE, poll: true}, - ]; - - _manager.registerListener(this, registerTypes); - display.dataList.addEventListener(ListEvent.CHANGE, selectedService); - display.httpList.addEventListener(ListEvent.CHANGE, selectedService); - display.messageList.addEventListener(ListEvent.CHANGE, selectedService); - display.remotingList.addEventListener(ListEvent.CHANGE, selectedService); - - display.destinationAttributes.addEventListener(ListEvent.CHANGE, selectedAttribute); - - pollableAttributes = new Object; - dataCache = new Bindable3DHashMap(); - - selectedBeanProperties = new ArrayCollection(); - selectedPropertyValues = new ArrayCollection(); - } - - private function selectedAttribute(e:Event):void - { - var property:String = e.target.selectedItem.Property as String; - var ret:ArrayCollection = dataCache.getBindableDataArray(selectedDestinationId, property); - if ((ret != null) && (ret.length >= 0)) - { - display.attrgraph.dataProvider = ret; - display.graphLabel.text = property; - } - /* - return; - - for (var type:* in pollableAttributes) - { - for each (var pollable:Object in pollableAttributes[type][selectedDestinationId]) - { - if (pollable.name == property) - { - display.attrgraph.dataProvider = dataCache.getBindableDataArray(selectedDestinationId, property); - display.graphLabel.text = property; - return; - } - } - } - */ - } - - private function selectedService(e:Event):void - { - selectedDestinationId = e.currentTarget.selectedItem.label; - selectedMBean = e.currentTarget.selectedItem.objectName.canonicalName.split(":")[1]; - display.destinationAttributes.dataProvider = dataCache.getBindableKeyArray(selectedDestinationId); - display.selectedProperty.text = e.currentTarget.selectedItem.label; - display.graphLabel.text = null; - display.attrgraph.dataProvider = null; - - if (e.currentTarget != display.httpList) - display.httpList.selectedIndex = -1; - if (e.currentTarget != display.messageList) - display.messageList.selectedIndex = -1; - if (e.currentTarget != display.dataList) - display.dataList.selectedIndex = -1; - if (e.currentTarget != display.remotingList) - display.remotingList.selectedIndex = -1; - } - - public override function appChanged(s:String):void - { - dataCache.clearData(); - refreshDestinations(); - display.destinationAttributes.dataProvider = null; - display.selectedProperty.text = null; - display.graphLabel.text = null; - display.attrgraph.dataProvider = null; - } - - private function refreshDestinations():void - { - // TODO: Handle not having any specific services gracefully - display.dataList.dataProvider = getChildTree("DataService"); - display.httpList.dataProvider = getChildTree("HTTPProxyService"); - display.messageList.dataProvider = getChildTree("MessageService"); - display.remotingList.dataProvider = getChildTree("RemotingService"); - } - - /** - * This is just a helper method to find the proper MBeans for each Service - * from the ConsoleManager's model. The model is a complicated structure - * of maps and arrays. - */ - private function getChildTree(child:String):Array - { - var childArray:Array = _manager.getChildTree(child); - if ((childArray.length > 0) && (childArray[0].hasOwnProperty("children"))) - childArray = childArray[0].children as Array; - if ((childArray.length > 0) && (childArray[0].hasOwnProperty("children"))) - childArray = childArray[0].children as Array; - - return childArray; - } - } +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package console.containers +{ + import console.data.Bindable3DHashMap; + import console.ConsoleManager; + import mx.collections.ArrayCollection; + import mx.events.ListEvent; + import flash.events.Event; + import mx.charts.LineChart; + import mx.charts.series.LineSeries; + import mx.controls.listClasses.ListBase; + import mx.events.CollectionEvent; + + public class DestinationManager extends UpdateListener + { + private static const pollableTypes:Array = [ + ConsoleManager.DESTINATION_POLLABLE ]; + + private var _manager:ConsoleManager; + private var display:DestinationManagerDisplay; + private var selectedDestinationId:String; + private var selectedMBean:String; + private var dataCache:Bindable3DHashMap; + private var pollableAttributes:Object; + + [Bindable] + private var selectedBeanProperties:ArrayCollection; + + [Bindable] + private var selectedPropertyValues:ArrayCollection; + + public override function dataUpdate(type:int, data:Object):void + { + var dataArray:ArrayCollection = new ArrayCollection; + + // This finds any exposed properties under any destination node and + // adds them to the proper data structures so that all data in MBeans + // underneath destinations can be accesed by the destination's id + for (var name:String in data) + { + var mapKey:String; + var mapValue:String; + + // Gets all properties for this MBean + var propertyArrayForMBean:Array = data[name]; + + // split the mbean name on the commas, then split on the periods and get the last + // type. if it contains destination, insert it into the array + // otherwise find the destination tag and insert it into it's data cache key. + var mbeanNames:Array = name.split(","); + + // find the actual type of this MBean, and if it is a Destination, we can use the id + // as the map key, otherwise, we have to find the MBean's parent which is a Destination + var types:Array = (mbeanNames[mbeanNames.length - 1] as String).split("."); + if ((types[types.length - 1] as String).indexOf("Destination") >= 0) + { + // we are going after the id pairing here, most often it will be the second + // to last pair but since WAS 6.1 inserts nodes and servers into + // the MBean name it may not be the case. For optimization we'll still + // go after the second to last pair, but will verify that this is indeed + // the id pair and if not will look for it explicitly. + var namePair:Array = (mbeanNames[mbeanNames.length - 2] as String).split("="); + + mapKey = namePair[0]; + mapValue = namePair[1]; + if (mapKey != "id") + { + // did not find id where expected go through entire name pair collection + // looking for the id pair + for each (var mbeanNamePair:String in mbeanNames) + { + var loopNamePair:Array = mbeanNamePair.split("="); + mapKey =loopNamePair[0]; + mapValue = loopNamePair[1]; + if (mapKey == "id") + { + break; + } + } + } + } + else + { + for each (var id:String in mbeanNames) + { + if (id.indexOf("Destination") >= 0) + { + // Get the Destination's id name as the key into the map + mapValue = id.split("=")[1]; + break; + } + } + } + + // For each property, add the property and value to the appropriate map + for (var i:int = 0; i < propertyArrayForMBean.length; i++) + { + if (pollableTypes.indexOf(type) >= 0) + dataCache.update(mapValue, propertyArrayForMBean[i].name, propertyArrayForMBean[i].value); + else + dataCache.updateNoPollable(mapValue, propertyArrayForMBean[i].name, propertyArrayForMBean[i].value) + } + } + } + + public override function mbeanModelUpdate(model:Object):void + { + refreshDestinations(); + } + + public function DestinationManager():void + { + super(); + display = new DestinationManagerDisplay; + this.addChild(display); + + this.label = "Destination Management"; + + _manager = ConsoleManager.getInstance(); + var registerTypes:Array = [ + {type: ConsoleManager.DESTINATION_GENERAL, poll: false}, + {type: ConsoleManager.DESTINATION_POLLABLE, poll: true}, + ]; + + _manager.registerListener(this, registerTypes); + display.dataList.addEventListener(ListEvent.CHANGE, selectedService); + display.httpList.addEventListener(ListEvent.CHANGE, selectedService); + display.messageList.addEventListener(ListEvent.CHANGE, selectedService); + display.remotingList.addEventListener(ListEvent.CHANGE, selectedService); + + display.destinationAttributes.addEventListener(ListEvent.CHANGE, selectedAttribute); + + pollableAttributes = new Object; + dataCache = new Bindable3DHashMap(); + + selectedBeanProperties = new ArrayCollection(); + selectedPropertyValues = new ArrayCollection(); + } + + private function selectedAttribute(e:Event):void + { + var property:String = e.target.selectedItem.Property as String; + var ret:ArrayCollection = dataCache.getBindableDataArray(selectedDestinationId, property); + if ((ret != null) && (ret.length >= 0)) + { + display.attrgraph.dataProvider = ret; + display.graphLabel.text = property; + } + /* + return; + + for (var type:* in pollableAttributes) + { + for each (var pollable:Object in pollableAttributes[type][selectedDestinationId]) + { + if (pollable.name == property) + { + display.attrgraph.dataProvider = dataCache.getBindableDataArray(selectedDestinationId, property); + display.graphLabel.text = property; + return; + } + } + } + */ + } + + private function selectedService(e:Event):void + { + selectedDestinationId = e.currentTarget.selectedItem.label; + selectedMBean = e.currentTarget.selectedItem.objectName.canonicalName.split(":")[1]; + display.destinationAttributes.dataProvider = dataCache.getBindableKeyArray(selectedDestinationId); + display.selectedProperty.text = e.currentTarget.selectedItem.label; + display.graphLabel.text = null; + display.attrgraph.dataProvider = null; + + if (e.currentTarget != display.httpList) + display.httpList.selectedIndex = -1; + if (e.currentTarget != display.messageList) + display.messageList.selectedIndex = -1; + if (e.currentTarget != display.dataList) + display.dataList.selectedIndex = -1; + if (e.currentTarget != display.remotingList) + display.remotingList.selectedIndex = -1; + } + + public override function appChanged(s:String):void + { + dataCache.clearData(); + refreshDestinations(); + display.destinationAttributes.dataProvider = null; + display.selectedProperty.text = null; + display.graphLabel.text = null; + display.attrgraph.dataProvider = null; + } + + private function refreshDestinations():void + { + // TODO: Handle not having any specific services gracefully + display.dataList.dataProvider = getChildTree("DataService"); + display.httpList.dataProvider = getChildTree("HTTPProxyService"); + display.messageList.dataProvider = getChildTree("MessageService"); + display.remotingList.dataProvider = getChildTree("RemotingService"); + } + + /** + * This is just a helper method to find the proper MBeans for each Service + * from the ConsoleManager's model. The model is a complicated structure + * of maps and arrays. + */ + private function getChildTree(child:String):Array + { + var childArray:Array = _manager.getChildTree(child); + if ((childArray.length > 0) && (childArray[0].hasOwnProperty("children"))) + childArray = childArray[0].children as Array; + if ((childArray.length > 0) && (childArray[0].hasOwnProperty("children"))) + childArray = childArray[0].children as Array; + + return childArray; + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/012fad7c/attic/apps/ds-console/console/containers/DestinationManagerDisplay.mxml ---------------------------------------------------------------------- diff --git a/attic/apps/ds-console/console/containers/DestinationManagerDisplay.mxml b/attic/apps/ds-console/console/containers/DestinationManagerDisplay.mxml index da46e3f..5e5d6a7 100755 --- a/attic/apps/ds-console/console/containers/DestinationManagerDisplay.mxml +++ b/attic/apps/ds-console/console/containers/DestinationManagerDisplay.mxml @@ -1,61 +1,61 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ---> -<mx:Box xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"> - <mx:HDividedBox width="100%" height="100%"> - <mx:VDividedBox height="100%" width="350"> - <mx:DataGrid id="httpList" width="100%"> - <mx:columns> - <mx:DataGridColumn headerText="HTTP Proxy Service" dataField="label" /> - </mx:columns> - </mx:DataGrid> - <mx:DataGrid id="messageList" width="100%"> - <mx:columns> - <mx:DataGridColumn headerText="Message Service" dataField="label" /> - </mx:columns> - </mx:DataGrid> - <mx:DataGrid id="dataList" width="100%"> - <mx:columns> - <mx:DataGridColumn headerText="Data Service" dataField="label" /> - </mx:columns> - </mx:DataGrid> - <mx:DataGrid id="remotingList" width="100%"> - <mx:columns> - <mx:DataGridColumn headerText="Remoting Service" dataField="label" /> - </mx:columns> - </mx:DataGrid> - </mx:VDividedBox> - <mx:VDividedBox height="100%"> - <mx:HBox> - <mx:Label text="Selected Attribute" /> - <mx:Text id="selectedProperty" /> - </mx:HBox> - <mx:DataGrid id="destinationAttributes" width="100%" height="50%" /> - <mx:Label id="graphLabel" /> - <mx:LineChart id="attrgraph" width="100%"> - <mx:verticalAxis> - <mx:LinearAxis id="attrgraphAxis" /> - </mx:verticalAxis> - <mx:series> - <mx:LineSeries id="attrgraphSeries" yField="Value" /> - </mx:series> - </mx:LineChart> - </mx:VDividedBox> - </mx:HDividedBox> -</mx:Box> +<?xml version="1.0" encoding="utf-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<mx:Box xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"> + <mx:HDividedBox width="100%" height="100%"> + <mx:VDividedBox height="100%" width="350"> + <mx:DataGrid id="httpList" width="100%"> + <mx:columns> + <mx:DataGridColumn headerText="HTTP Proxy Service" dataField="label" /> + </mx:columns> + </mx:DataGrid> + <mx:DataGrid id="messageList" width="100%"> + <mx:columns> + <mx:DataGridColumn headerText="Message Service" dataField="label" /> + </mx:columns> + </mx:DataGrid> + <mx:DataGrid id="dataList" width="100%"> + <mx:columns> + <mx:DataGridColumn headerText="Data Service" dataField="label" /> + </mx:columns> + </mx:DataGrid> + <mx:DataGrid id="remotingList" width="100%"> + <mx:columns> + <mx:DataGridColumn headerText="Remoting Service" dataField="label" /> + </mx:columns> + </mx:DataGrid> + </mx:VDividedBox> + <mx:VDividedBox height="100%"> + <mx:HBox> + <mx:Label text="Selected Attribute" /> + <mx:Text id="selectedProperty" /> + </mx:HBox> + <mx:DataGrid id="destinationAttributes" width="100%" height="50%" /> + <mx:Label id="graphLabel" /> + <mx:LineChart id="attrgraph" width="100%"> + <mx:verticalAxis> + <mx:LinearAxis id="attrgraphAxis" /> + </mx:verticalAxis> + <mx:series> + <mx:LineSeries id="attrgraphSeries" yField="Value" /> + </mx:series> + </mx:LineChart> + </mx:VDividedBox> + </mx:HDividedBox> +</mx:Box> http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/012fad7c/attic/apps/ds-console/console/containers/EndpointManager.as ---------------------------------------------------------------------- diff --git a/attic/apps/ds-console/console/containers/EndpointManager.as b/attic/apps/ds-console/console/containers/EndpointManager.as index 3523721..0c7a538 100755 --- a/attic/apps/ds-console/console/containers/EndpointManager.as +++ b/attic/apps/ds-console/console/containers/EndpointManager.as @@ -1,149 +1,149 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package console.containers -{ - import console.data.Bindable3DHashMap; - import console.ConsoleManager; - import mx.collections.ArrayCollection; - import mx.events.ListEvent; - import flash.events.Event; - import mx.charts.LineChart; - import mx.charts.series.LineSeries; - import mx.controls.listClasses.ListBase; - import mx.events.CollectionEvent; - - public class EndpointManager extends UpdateListener - { - private static const pollableTypes:Array = [ - ConsoleManager.ENDPOINT_POLLABLE ]; - - private var _manager:ConsoleManager; - private var display:EndpointManagerDisplay; - private var selectedMBean:String; - private var dataCache:Bindable3DHashMap; - private var pollableAttributes:Object; - - [Bindable] - private var selectedBeanProperties:ArrayCollection; - - [Bindable] - private var selectedPropertyValues:ArrayCollection; - - public override function dataUpdate(type:int, data:Object):void - { - var dataArray:ArrayCollection = new ArrayCollection; - - for (var name:String in data) - { - - var propertyArrayForMBean:Array = data[name]; - - for (var i:int = 0; i < propertyArrayForMBean.length; i++) - { - dataCache.update(name, propertyArrayForMBean[i].name, propertyArrayForMBean[i].value); - } - } - - if (pollableTypes.indexOf(type) >= 0) - pollableAttributes[type] = data; - } - - public override function mbeanModelUpdate(model:Object):void - { - refreshEndpoints(); - } - - public function EndpointManager():void - { - super(); - display = new EndpointManagerDisplay; - this.addChild(display); - - this.label = "Endpoint Management"; - - _manager = ConsoleManager.getInstance(); - var registerTypes:Array = [ - {type: ConsoleManager.ENDPOINT_POLLABLE, poll: true}, - {type: ConsoleManager.ENDPOINT_SCALAR, poll: false} - ] - _manager.registerListener(this, registerTypes); - display.rtmpEndpointsList.addEventListener(ListEvent.CHANGE, selectedEndpoint); - display.amfEndpointsList.addEventListener(ListEvent.CHANGE, selectedEndpoint); - display.httpEndpointsList.addEventListener(ListEvent.CHANGE, selectedEndpoint); - - display.endpointAttributes.addEventListener(ListEvent.CHANGE, selectedAttribute); - - pollableAttributes = new Object; - dataCache = new Bindable3DHashMap(); - - selectedBeanProperties = new ArrayCollection(); - selectedPropertyValues = new ArrayCollection(); - } - - private function selectedAttribute(e:Event):void - { - var property:String = e.currentTarget.selectedItem.Property as String; - for (var type:* in pollableAttributes) - { - for each (var pollable:Object in pollableAttributes[type][selectedMBean]) - { - if (pollable.name == property) - { - display.attrgraph.dataProvider = dataCache.getBindableDataArray(selectedMBean, property); - display.graphLabel.text = property; - return; - } - } - } - } - - private function selectedEndpoint(e:Event):void - { - selectedMBean = ((e.currentTarget.selectedItem.objectName.canonicalName as String).split(":") as Array)[1]; - display.endpointAttributes.dataProvider = dataCache.getBindableKeyArray(selectedMBean); - display.selectedProperty.text = e.currentTarget.selectedItem.label; - display.graphLabel.text = null; - display.attrgraph.dataProvider = null; - - if (e.currentTarget != display.amfEndpointsList) - display.amfEndpointsList.selectedIndex = -1; - if (e.currentTarget != display.httpEndpointsList) - display.httpEndpointsList.selectedIndex = -1; - if (e.currentTarget != display.rtmpEndpointsList) - display.rtmpEndpointsList.selectedIndex = -1; - } - - public override function appChanged(s:String):void - { - dataCache.clearData(); - refreshEndpoints(); - display.endpointAttributes.dataProvider = null; - display.selectedProperty.text = null; - display.graphLabel.text = null; - display.attrgraph.dataProvider = null; - } - - private function refreshEndpoints():void - { - display.httpEndpointsList.dataProvider = _manager.getChildTrees("HTTPEndpoint", "StreamingHTTPEndpoint", "NIOHTTPEndpoint", "StreamingNIOHTTPEndpoint"); - display.rtmpEndpointsList.dataProvider = _manager.getChildTree("RTMPEndpoint"); - display.amfEndpointsList.dataProvider = _manager.getChildTrees("AMFEndpoint", "StreamingAMFEndpoint", "NIOAMFEndpoint", "StreamingNIOAMFEndpoint"); - } - } +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package console.containers +{ + import console.data.Bindable3DHashMap; + import console.ConsoleManager; + import mx.collections.ArrayCollection; + import mx.events.ListEvent; + import flash.events.Event; + import mx.charts.LineChart; + import mx.charts.series.LineSeries; + import mx.controls.listClasses.ListBase; + import mx.events.CollectionEvent; + + public class EndpointManager extends UpdateListener + { + private static const pollableTypes:Array = [ + ConsoleManager.ENDPOINT_POLLABLE ]; + + private var _manager:ConsoleManager; + private var display:EndpointManagerDisplay; + private var selectedMBean:String; + private var dataCache:Bindable3DHashMap; + private var pollableAttributes:Object; + + [Bindable] + private var selectedBeanProperties:ArrayCollection; + + [Bindable] + private var selectedPropertyValues:ArrayCollection; + + public override function dataUpdate(type:int, data:Object):void + { + var dataArray:ArrayCollection = new ArrayCollection; + + for (var name:String in data) + { + + var propertyArrayForMBean:Array = data[name]; + + for (var i:int = 0; i < propertyArrayForMBean.length; i++) + { + dataCache.update(name, propertyArrayForMBean[i].name, propertyArrayForMBean[i].value); + } + } + + if (pollableTypes.indexOf(type) >= 0) + pollableAttributes[type] = data; + } + + public override function mbeanModelUpdate(model:Object):void + { + refreshEndpoints(); + } + + public function EndpointManager():void + { + super(); + display = new EndpointManagerDisplay; + this.addChild(display); + + this.label = "Endpoint Management"; + + _manager = ConsoleManager.getInstance(); + var registerTypes:Array = [ + {type: ConsoleManager.ENDPOINT_POLLABLE, poll: true}, + {type: ConsoleManager.ENDPOINT_SCALAR, poll: false} + ] + _manager.registerListener(this, registerTypes); + display.rtmpEndpointsList.addEventListener(ListEvent.CHANGE, selectedEndpoint); + display.amfEndpointsList.addEventListener(ListEvent.CHANGE, selectedEndpoint); + display.httpEndpointsList.addEventListener(ListEvent.CHANGE, selectedEndpoint); + + display.endpointAttributes.addEventListener(ListEvent.CHANGE, selectedAttribute); + + pollableAttributes = new Object; + dataCache = new Bindable3DHashMap(); + + selectedBeanProperties = new ArrayCollection(); + selectedPropertyValues = new ArrayCollection(); + } + + private function selectedAttribute(e:Event):void + { + var property:String = e.currentTarget.selectedItem.Property as String; + for (var type:* in pollableAttributes) + { + for each (var pollable:Object in pollableAttributes[type][selectedMBean]) + { + if (pollable.name == property) + { + display.attrgraph.dataProvider = dataCache.getBindableDataArray(selectedMBean, property); + display.graphLabel.text = property; + return; + } + } + } + } + + private function selectedEndpoint(e:Event):void + { + selectedMBean = ((e.currentTarget.selectedItem.objectName.canonicalName as String).split(":") as Array)[1]; + display.endpointAttributes.dataProvider = dataCache.getBindableKeyArray(selectedMBean); + display.selectedProperty.text = e.currentTarget.selectedItem.label; + display.graphLabel.text = null; + display.attrgraph.dataProvider = null; + + if (e.currentTarget != display.amfEndpointsList) + display.amfEndpointsList.selectedIndex = -1; + if (e.currentTarget != display.httpEndpointsList) + display.httpEndpointsList.selectedIndex = -1; + if (e.currentTarget != display.rtmpEndpointsList) + display.rtmpEndpointsList.selectedIndex = -1; + } + + public override function appChanged(s:String):void + { + dataCache.clearData(); + refreshEndpoints(); + display.endpointAttributes.dataProvider = null; + display.selectedProperty.text = null; + display.graphLabel.text = null; + display.attrgraph.dataProvider = null; + } + + private function refreshEndpoints():void + { + display.httpEndpointsList.dataProvider = _manager.getChildTrees("HTTPEndpoint", "StreamingHTTPEndpoint", "NIOHTTPEndpoint", "StreamingNIOHTTPEndpoint"); + display.rtmpEndpointsList.dataProvider = _manager.getChildTree("RTMPEndpoint"); + display.amfEndpointsList.dataProvider = _manager.getChildTrees("AMFEndpoint", "StreamingAMFEndpoint", "NIOAMFEndpoint", "StreamingNIOAMFEndpoint"); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/012fad7c/attic/apps/ds-console/console/containers/EndpointManagerDisplay.mxml ---------------------------------------------------------------------- diff --git a/attic/apps/ds-console/console/containers/EndpointManagerDisplay.mxml b/attic/apps/ds-console/console/containers/EndpointManagerDisplay.mxml index 6d4ecbe..c5f69ef 100755 --- a/attic/apps/ds-console/console/containers/EndpointManagerDisplay.mxml +++ b/attic/apps/ds-console/console/containers/EndpointManagerDisplay.mxml @@ -1,56 +1,56 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ---> -<mx:Box xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"> - <mx:HDividedBox width="100%" height="100%"> - <mx:VDividedBox height="100%" width="350"> - <mx:DataGrid id="rtmpEndpointsList" width="100%"> - <mx:columns> - <mx:DataGridColumn headerText="RTMP Endpoints" dataField="label" /> - </mx:columns> - </mx:DataGrid> - <mx:DataGrid id="httpEndpointsList" width="100%"> - <mx:columns> - <mx:DataGridColumn headerText="HTTP Endpoints" dataField="label" /> - </mx:columns> - </mx:DataGrid> - <mx:DataGrid id="amfEndpointsList" width="100%"> - <mx:columns> - <mx:DataGridColumn headerText="AMF Endpoints" dataField="label" /> - </mx:columns> - </mx:DataGrid> - </mx:VDividedBox> - <mx:VDividedBox height="100%"> - <mx:HBox> - <mx:Label text="Selected Endpoint" /> - <mx:Text id="selectedProperty" /> - </mx:HBox> - <mx:DataGrid id="endpointAttributes" width="100%" height="50%" /> - <mx:Label id="graphLabel" /> - <mx:LineChart id="attrgraph" width="100%"> - <mx:verticalAxis> - <mx:LinearAxis id="attrgraphAxis" /> - </mx:verticalAxis> - <mx:series> - <mx:LineSeries id="attrgraphSeries" yField="Value" /> - </mx:series> - </mx:LineChart> - </mx:VDividedBox> - </mx:HDividedBox> -</mx:Box> +<?xml version="1.0" encoding="utf-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<mx:Box xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"> + <mx:HDividedBox width="100%" height="100%"> + <mx:VDividedBox height="100%" width="350"> + <mx:DataGrid id="rtmpEndpointsList" width="100%"> + <mx:columns> + <mx:DataGridColumn headerText="RTMP Endpoints" dataField="label" /> + </mx:columns> + </mx:DataGrid> + <mx:DataGrid id="httpEndpointsList" width="100%"> + <mx:columns> + <mx:DataGridColumn headerText="HTTP Endpoints" dataField="label" /> + </mx:columns> + </mx:DataGrid> + <mx:DataGrid id="amfEndpointsList" width="100%"> + <mx:columns> + <mx:DataGridColumn headerText="AMF Endpoints" dataField="label" /> + </mx:columns> + </mx:DataGrid> + </mx:VDividedBox> + <mx:VDividedBox height="100%"> + <mx:HBox> + <mx:Label text="Selected Endpoint" /> + <mx:Text id="selectedProperty" /> + </mx:HBox> + <mx:DataGrid id="endpointAttributes" width="100%" height="50%" /> + <mx:Label id="graphLabel" /> + <mx:LineChart id="attrgraph" width="100%"> + <mx:verticalAxis> + <mx:LinearAxis id="attrgraphAxis" /> + </mx:verticalAxis> + <mx:series> + <mx:LineSeries id="attrgraphSeries" yField="Value" /> + </mx:series> + </mx:LineChart> + </mx:VDividedBox> + </mx:HDividedBox> +</mx:Box>
