http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/012fad7c/attic/apps/ds-console/console/containers/LogManager.as ---------------------------------------------------------------------- diff --git a/attic/apps/ds-console/console/containers/LogManager.as b/attic/apps/ds-console/console/containers/LogManager.as index 3d47957..a44dc06 100755 --- a/attic/apps/ds-console/console/containers/LogManager.as +++ b/attic/apps/ds-console/console/containers/LogManager.as @@ -1,189 +1,189 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// 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 flash.events.Event; - import mx.controls.ComboBox; - import console.events.ManagementOperationInvokeEvent; - import mx.events.ListEvent; - import flash.events.MouseEvent; - import mx.collections.ArrayCollection; - - public class LogManager extends UpdateListener - { - private var _manager:ConsoleManager; - private var _logMBean:String; - private var _logTree:Array; - private var display:LogManagerDisplay; - - public static var targetLevels:Array = new Array( - {label:"NONE", value:"2000"}, - {label:"FATAL", value:"1000"}, - {label:"ERROR", value:"8"}, - {label:"WARN", value:"6"}, - {label:"INFO", value:"4"}, - {label:"DEBUG", value:"2"}, - {label:"ALL", value:"0"} - ); - - public function LogManager():void - { - super(); - - display = new LogManagerDisplay; - this.addChild(display); - - this.label = "Log Manager"; - - _manager = ConsoleManager.getInstance(); - _manager.registerListener(this, []); - - // On selecting a log target, invoke 'getTargetFilters' to populate the table of filters - display.logTargetSelect.addEventListener(ListEvent.CHANGE, selectLogTarget); - display.logTargetLevel.dataProvider = targetLevels; - - // Handler for removing a target - display.deleteCategory.addEventListener(MouseEvent.CLICK, - function(e:Event):void { - - _manager.invokeOperation( - - new ManagementOperationInvokeEvent(_logMBean, - "removeFilterForTarget", - [display.logTargetSelect.selectedItem, display.currentCategories.selectedItem], - ["java.lang.String", "java.lang.String"]), - - function (e:Event):void { display.logTargetSelect.dispatchEvent( - new Event(ListEvent.CHANGE)); } ); - } - ); - - // Handler for adding a target - display.addFilterButton.addEventListener(MouseEvent.CLICK, - function(e:Event):void { - - _manager.invokeOperation( - - new ManagementOperationInvokeEvent(_logMBean, - "addFilterForTarget", - [display.logTargetSelect.selectedItem, display.addFilterTextInput.text], - ["java.lang.String", "java.lang.String"]), - // Simple callback function to refresh the Log View - function (e:Event):void { - display.logTargetSelect.dispatchEvent(new Event(ListEvent.CHANGE)); - display.addFilterTextInput.text = ""; - } - ); - } - ); - - // Handler for adding a target - display.addCommonFilterButton.addEventListener(MouseEvent.CLICK, - function(e:Event):void { - - _manager.invokeOperation( - - new ManagementOperationInvokeEvent(_logMBean, - "addFilterForTarget", - [display.logTargetSelect.selectedItem, display.commonCategories.selectedItem], - ["java.lang.String", "java.lang.String"]), - // Simple callback function to refresh the Log View - function (e:Event):void { - display.logTargetSelect.dispatchEvent(new Event(ListEvent.CHANGE)); - display.addFilterTextInput.text = ""; - } - ); - } - ); - - // Handler for changing the target's level - display.logTargetLevel.addEventListener(ListEvent.CHANGE, function(e:Event):void - { - _manager.invokeOperation( - - new ManagementOperationInvokeEvent(_logMBean, - "changeTargetLevel", - [display.logTargetSelect.selectedItem, display.logTargetLevel.selectedItem.value], - ["java.lang.String", "java.lang.String"]), - new Function - ); - } - ); - - } - - public override function mbeanModelUpdate(model:Object):void - { - _logTree = _manager.getChildTree("Log"); - if (_logTree != null && _logTree.length != 0) - { - _logMBean = _logTree[0]["objectName"]["canonicalName"]; - // Get the targets for the current application - _manager.getAttributes(_logMBean, ["Targets"], this, updateTargets); - _manager.getAttributes(_logMBean, ["Categories"], this, updateCommonCats); - } - } - - public override function appChanged(s:String):void - { - mbeanModelUpdate(null); - } - - public function updateCommonCats(e:Event):void - { - display.commonCategories.dataProvider = (e["result"] as Array)[0].value; - display.commonCategories.selectedIndex = 0; - display.commonCategories.dispatchEvent(new Event(ListEvent.CHANGE)); - } - - public function updateTargets(e:Event):void - { - var logTargets:Array = (e["result"] as Array)[0].value; - display.logTargetSelect.dataProvider = logTargets; - display.logTargetSelect.selectedIndex = 0; - display.logTargetSelect.dispatchEvent(new Event(ListEvent.CHANGE)); - } - - public function updateFilters(e:Event):void - { - display.currentCategories.dataProvider = e["result"] as Array; - } - - public function selectLogTarget(e:Event):void - { - _manager.invokeOperation(new ManagementOperationInvokeEvent(_logMBean, - "getTargetFilters", [display.logTargetSelect.selectedItem], ["java.lang.String"]), - updateFilters); - _manager.invokeOperation(new ManagementOperationInvokeEvent(_logMBean, - "getTargetLevel", [display.logTargetSelect.selectedItem], ["java.lang.String"]), - handleGetTargetLevel); - } - - public function handleGetTargetLevel(e:Event):void - { - var currentLevelInt:String = e["message"]["body"]; - for (var i:int = 0; i < targetLevels.length; i++) - { - if (targetLevels[i].value == currentLevelInt) - display.logTargetLevel.selectedIndex = i; - } - } - } +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flash.events.Event; + import mx.controls.ComboBox; + import console.events.ManagementOperationInvokeEvent; + import mx.events.ListEvent; + import flash.events.MouseEvent; + import mx.collections.ArrayCollection; + + public class LogManager extends UpdateListener + { + private var _manager:ConsoleManager; + private var _logMBean:String; + private var _logTree:Array; + private var display:LogManagerDisplay; + + public static var targetLevels:Array = new Array( + {label:"NONE", value:"2000"}, + {label:"FATAL", value:"1000"}, + {label:"ERROR", value:"8"}, + {label:"WARN", value:"6"}, + {label:"INFO", value:"4"}, + {label:"DEBUG", value:"2"}, + {label:"ALL", value:"0"} + ); + + public function LogManager():void + { + super(); + + display = new LogManagerDisplay; + this.addChild(display); + + this.label = "Log Manager"; + + _manager = ConsoleManager.getInstance(); + _manager.registerListener(this, []); + + // On selecting a log target, invoke 'getTargetFilters' to populate the table of filters + display.logTargetSelect.addEventListener(ListEvent.CHANGE, selectLogTarget); + display.logTargetLevel.dataProvider = targetLevels; + + // Handler for removing a target + display.deleteCategory.addEventListener(MouseEvent.CLICK, + function(e:Event):void { + + _manager.invokeOperation( + + new ManagementOperationInvokeEvent(_logMBean, + "removeFilterForTarget", + [display.logTargetSelect.selectedItem, display.currentCategories.selectedItem], + ["java.lang.String", "java.lang.String"]), + + function (e:Event):void { display.logTargetSelect.dispatchEvent( + new Event(ListEvent.CHANGE)); } ); + } + ); + + // Handler for adding a target + display.addFilterButton.addEventListener(MouseEvent.CLICK, + function(e:Event):void { + + _manager.invokeOperation( + + new ManagementOperationInvokeEvent(_logMBean, + "addFilterForTarget", + [display.logTargetSelect.selectedItem, display.addFilterTextInput.text], + ["java.lang.String", "java.lang.String"]), + // Simple callback function to refresh the Log View + function (e:Event):void { + display.logTargetSelect.dispatchEvent(new Event(ListEvent.CHANGE)); + display.addFilterTextInput.text = ""; + } + ); + } + ); + + // Handler for adding a target + display.addCommonFilterButton.addEventListener(MouseEvent.CLICK, + function(e:Event):void { + + _manager.invokeOperation( + + new ManagementOperationInvokeEvent(_logMBean, + "addFilterForTarget", + [display.logTargetSelect.selectedItem, display.commonCategories.selectedItem], + ["java.lang.String", "java.lang.String"]), + // Simple callback function to refresh the Log View + function (e:Event):void { + display.logTargetSelect.dispatchEvent(new Event(ListEvent.CHANGE)); + display.addFilterTextInput.text = ""; + } + ); + } + ); + + // Handler for changing the target's level + display.logTargetLevel.addEventListener(ListEvent.CHANGE, function(e:Event):void + { + _manager.invokeOperation( + + new ManagementOperationInvokeEvent(_logMBean, + "changeTargetLevel", + [display.logTargetSelect.selectedItem, display.logTargetLevel.selectedItem.value], + ["java.lang.String", "java.lang.String"]), + new Function + ); + } + ); + + } + + public override function mbeanModelUpdate(model:Object):void + { + _logTree = _manager.getChildTree("Log"); + if (_logTree != null && _logTree.length != 0) + { + _logMBean = _logTree[0]["objectName"]["canonicalName"]; + // Get the targets for the current application + _manager.getAttributes(_logMBean, ["Targets"], this, updateTargets); + _manager.getAttributes(_logMBean, ["Categories"], this, updateCommonCats); + } + } + + public override function appChanged(s:String):void + { + mbeanModelUpdate(null); + } + + public function updateCommonCats(e:Event):void + { + display.commonCategories.dataProvider = (e["result"] as Array)[0].value; + display.commonCategories.selectedIndex = 0; + display.commonCategories.dispatchEvent(new Event(ListEvent.CHANGE)); + } + + public function updateTargets(e:Event):void + { + var logTargets:Array = (e["result"] as Array)[0].value; + display.logTargetSelect.dataProvider = logTargets; + display.logTargetSelect.selectedIndex = 0; + display.logTargetSelect.dispatchEvent(new Event(ListEvent.CHANGE)); + } + + public function updateFilters(e:Event):void + { + display.currentCategories.dataProvider = e["result"] as Array; + } + + public function selectLogTarget(e:Event):void + { + _manager.invokeOperation(new ManagementOperationInvokeEvent(_logMBean, + "getTargetFilters", [display.logTargetSelect.selectedItem], ["java.lang.String"]), + updateFilters); + _manager.invokeOperation(new ManagementOperationInvokeEvent(_logMBean, + "getTargetLevel", [display.logTargetSelect.selectedItem], ["java.lang.String"]), + handleGetTargetLevel); + } + + public function handleGetTargetLevel(e:Event):void + { + var currentLevelInt:String = e["message"]["body"]; + for (var i:int = 0; i < targetLevels.length; i++) + { + if (targetLevels[i].value == currentLevelInt) + display.logTargetLevel.selectedIndex = i; + } + } + } } \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/012fad7c/attic/apps/ds-console/console/containers/LogManagerDisplay.mxml ---------------------------------------------------------------------- diff --git a/attic/apps/ds-console/console/containers/LogManagerDisplay.mxml b/attic/apps/ds-console/console/containers/LogManagerDisplay.mxml index 40e1f6e..969c9d4 100755 --- a/attic/apps/ds-console/console/containers/LogManagerDisplay.mxml +++ b/attic/apps/ds-console/console/containers/LogManagerDisplay.mxml @@ -1,54 +1,54 @@ -<?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:HBox width="100%" height="100%"> - <mx:Form> - <mx:FormItem label="Log Target:"> - <mx:ComboBox id="logTargetSelect" /> - </mx:FormItem> - <mx:FormItem label="Target Level:"> - <mx:ComboBox id="logTargetLevel"></mx:ComboBox> - </mx:FormItem> - <mx:HRule width="100%"/> - <mx:FormItem label="Add a Custom Category"> - <mx:TextInput id="addFilterTextInput" /> - </mx:FormItem> - <mx:FormItem> - <mx:Button label="Add Category" id="addFilterButton" /> - </mx:FormItem> - </mx:Form> - <mx:VBox width="100%"> - <mx:DataGrid id="currentCategories" width="100%"> - <mx:columns> - <mx:DataGridColumn headerText="Current Categories" dataField="filters" /> - </mx:columns> - </mx:DataGrid> - <mx:Button label="Remove Category" id="deleteCategory" /> - </mx:VBox> - <mx:VBox width="100%"> - <mx:DataGrid id="commonCategories" width="100%"> - <mx:columns> - <mx:DataGridColumn headerText="Common Categories" dataField="common"/> - </mx:columns> - </mx:DataGrid> - <mx:Button label="Add Category" id="addCommonFilterButton" /> - </mx:VBox> - </mx:HBox> -</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:HBox width="100%" height="100%"> + <mx:Form> + <mx:FormItem label="Log Target:"> + <mx:ComboBox id="logTargetSelect" /> + </mx:FormItem> + <mx:FormItem label="Target Level:"> + <mx:ComboBox id="logTargetLevel"></mx:ComboBox> + </mx:FormItem> + <mx:HRule width="100%"/> + <mx:FormItem label="Add a Custom Category"> + <mx:TextInput id="addFilterTextInput" /> + </mx:FormItem> + <mx:FormItem> + <mx:Button label="Add Category" id="addFilterButton" /> + </mx:FormItem> + </mx:Form> + <mx:VBox width="100%"> + <mx:DataGrid id="currentCategories" width="100%"> + <mx:columns> + <mx:DataGridColumn headerText="Current Categories" dataField="filters" /> + </mx:columns> + </mx:DataGrid> + <mx:Button label="Remove Category" id="deleteCategory" /> + </mx:VBox> + <mx:VBox width="100%"> + <mx:DataGrid id="commonCategories" width="100%"> + <mx:columns> + <mx:DataGridColumn headerText="Common Categories" dataField="common"/> + </mx:columns> + </mx:DataGrid> + <mx:Button label="Add Category" id="addCommonFilterButton" /> + </mx:VBox> + </mx:HBox> +</mx:VBox> http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/012fad7c/attic/apps/ds-console/console/containers/Operation.as ---------------------------------------------------------------------- diff --git a/attic/apps/ds-console/console/containers/Operation.as b/attic/apps/ds-console/console/containers/Operation.as index 3a10448..2b9788e 100755 --- a/attic/apps/ds-console/console/containers/Operation.as +++ b/attic/apps/ds-console/console/containers/Operation.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 flash.events.MouseEvent; -import mx.containers.HBox; -import mx.controls.Button; -import mx.controls.Label; -import mx.controls.TextInput; -import mx.messaging.management.MBeanOperationInfo; -import mx.messaging.management.MBeanParameterInfo; - -/** - * The Operation container is an HBox that renders UI to invoke an operation on - * an MBean. When the operationInfo property of an Operation is set, the current - * UI for the Operation is torn down, and new UI is rendered based on the new - * MBeanOperationInfo metadata provided. - * <p> - * This container/control should not be instantiated directly. A parent OperationSet - * container will create nested Operations based on its MBean metadata. - */ -public class Operation extends HBox -{ - //-------------------------------------------------------------------------- - // - // Constructor - // - //-------------------------------------------------------------------------- - - /** - * @private - * Constructor. - */ - public function Operation(wrapper:OperationSet) - { - super(); - - _wrapper = wrapper; - _values = []; - _signature = []; - } - - /** - * @private - * The parent container. - */ - private var _wrapper:OperationSet; - - /** - * @private - * Array to store references to controls for each argument. - */ - private var _values:Array; - - /** - * @private - * Array to store the type signature for this operation. - */ - private var _signature:Array; - - //---------------------------------- - // MBeanOperationInfo - //---------------------------------- - - /** - * @private - * Storage for the operation info. - */ - private var _operationInfo:MBeanOperationInfo; - - /** - * MBean operation metadata that drives the UI for this component. - */ - public function get operationInfo():MBeanOperationInfo - { - return _operationInfo; - } - - public function set operationInfo(value:MBeanOperationInfo):void - { - var i:int; - - _operationInfo = value; - // Remove any existing children and refs to argument values. - _values.splice(0); - _signature.splice(0); - for (i = numChildren - 1; i >= 0; --i) - { - removeChildAt(i); - } - - // Build UI for this operation. - var opName:Button = new Button(); - opName.label = value.name; - opName.addEventListener("click", invokeOperation); - addChild(opName); - - var openParen:Label = new Label(); - openParen.text = " ("; - addChild(openParen); - - var comma:Label = new Label(); - comma.text = ", "; - var paramName:String; - var n:int = value.signature.length; - for (i = 0; i < n; ++i) - { - var pName:Label = new Label(); - paramName = value.signature[i].name; - if (paramName.length > 0) - { - pName.text = paramName; - } - else - { - pName.text = "p" + (i + 1); - } - addChild(pName); - var pValue:TextInput = new TextInput(); - addChild(pValue); - _values[i] = pValue; - _signature[i] = value.signature[i].type; - if (i != (n - 1)) - { - addChild(comma); - } - } - - var closeParen:Label = new Label(); - closeParen.text = " ) "; - addChild(closeParen); - } - - /** - * @private - * Calls back into the parent OperationSet to dispatch an - * event for this operation invocation request. - */ - private function invokeOperation(e:MouseEvent):void - { - var argsToPass:Array = []; - var n:int = _values.length; - for (var i:int = 0; i < n; ++i) - { - argsToPass.push(_values[i].text); - } - _wrapper.dispatchInvokeEvent(_operationInfo.name, argsToPass, _signature); - } -} - +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flash.events.MouseEvent; +import mx.containers.HBox; +import mx.controls.Button; +import mx.controls.Label; +import mx.controls.TextInput; +import mx.messaging.management.MBeanOperationInfo; +import mx.messaging.management.MBeanParameterInfo; + +/** + * The Operation container is an HBox that renders UI to invoke an operation on + * an MBean. When the operationInfo property of an Operation is set, the current + * UI for the Operation is torn down, and new UI is rendered based on the new + * MBeanOperationInfo metadata provided. + * <p> + * This container/control should not be instantiated directly. A parent OperationSet + * container will create nested Operations based on its MBean metadata. + */ +public class Operation extends HBox +{ + //-------------------------------------------------------------------------- + // + // Constructor + // + //-------------------------------------------------------------------------- + + /** + * @private + * Constructor. + */ + public function Operation(wrapper:OperationSet) + { + super(); + + _wrapper = wrapper; + _values = []; + _signature = []; + } + + /** + * @private + * The parent container. + */ + private var _wrapper:OperationSet; + + /** + * @private + * Array to store references to controls for each argument. + */ + private var _values:Array; + + /** + * @private + * Array to store the type signature for this operation. + */ + private var _signature:Array; + + //---------------------------------- + // MBeanOperationInfo + //---------------------------------- + + /** + * @private + * Storage for the operation info. + */ + private var _operationInfo:MBeanOperationInfo; + + /** + * MBean operation metadata that drives the UI for this component. + */ + public function get operationInfo():MBeanOperationInfo + { + return _operationInfo; + } + + public function set operationInfo(value:MBeanOperationInfo):void + { + var i:int; + + _operationInfo = value; + // Remove any existing children and refs to argument values. + _values.splice(0); + _signature.splice(0); + for (i = numChildren - 1; i >= 0; --i) + { + removeChildAt(i); + } + + // Build UI for this operation. + var opName:Button = new Button(); + opName.label = value.name; + opName.addEventListener("click", invokeOperation); + addChild(opName); + + var openParen:Label = new Label(); + openParen.text = " ("; + addChild(openParen); + + var comma:Label = new Label(); + comma.text = ", "; + var paramName:String; + var n:int = value.signature.length; + for (i = 0; i < n; ++i) + { + var pName:Label = new Label(); + paramName = value.signature[i].name; + if (paramName.length > 0) + { + pName.text = paramName; + } + else + { + pName.text = "p" + (i + 1); + } + addChild(pName); + var pValue:TextInput = new TextInput(); + addChild(pValue); + _values[i] = pValue; + _signature[i] = value.signature[i].type; + if (i != (n - 1)) + { + addChild(comma); + } + } + + var closeParen:Label = new Label(); + closeParen.text = " ) "; + addChild(closeParen); + } + + /** + * @private + * Calls back into the parent OperationSet to dispatch an + * event for this operation invocation request. + */ + private function invokeOperation(e:MouseEvent):void + { + var argsToPass:Array = []; + var n:int = _values.length; + for (var i:int = 0; i < n; ++i) + { + argsToPass.push(_values[i].text); + } + _wrapper.dispatchInvokeEvent(_operationInfo.name, argsToPass, _signature); + } +} + } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/012fad7c/attic/apps/ds-console/console/containers/OperationSet.as ---------------------------------------------------------------------- diff --git a/attic/apps/ds-console/console/containers/OperationSet.as b/attic/apps/ds-console/console/containers/OperationSet.as index f3f537a..98ca6de 100755 --- a/attic/apps/ds-console/console/containers/OperationSet.as +++ b/attic/apps/ds-console/console/containers/OperationSet.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.events.ManagementOperationInvokeEvent; - -import mx.containers.*; -import mx.messaging.management.MBeanInfo; - -//-------------------------------------- -// Events -//-------------------------------------- - -/** - * Broadcast when a request has been made to invoke an Operation within this OperationSet. - */ -[Event(name="invoke", type="console.events.ManagementOperationInvokeEvent")] - -/** - * The OperationSet is a VBox containing an Operation for each operation exposed by a - * MBean. When the mbeanInfo property is set, the current UI of the OperationSet is torn - * down and new UI is built based upon the MBeanInfo metadata provided. - * - * <p><b>MXML Syntax</b></p> - * - * <p>The <code><mx:OperationSet></code> tag inherits all the properties - * of its parent classes and adds the following properties:</p> - * - * <p> - * <pre> - * <mx:Button - * mbeanInfo="<i>No default</i>." - * /> - * </pre> - * </p> - */ -public class OperationSet extends VBox -{ - //-------------------------------------------------------------------------- - // - // Constructor - // - //-------------------------------------------------------------------------- - - /** - * @private - * Constructor. - */ - public function OperationSet() - { - super(); - } - - - - - //---------------------------------- - // MBeanOperationInfo - //---------------------------------- - - private var _mbeanName:String; - public function set mbeanName(name:String):void - { - _mbeanName = name; - } - - /** - * @private - * Storage for the Mbean info. - */ - private var _mbeanInfo:MBeanInfo; - - /** - * MBean metadata to drive the UI for this component. - */ - public function get mbeanInfo():MBeanInfo - { - return _mbeanInfo; - } - - - private var _tabnav:TabNavigator; - public function set tabnav(p:TabNavigator):void - { - _tabnav = p; - } - - public function set mbeanInfo(value:MBeanInfo):void - { - var i:int; - - _mbeanInfo = value; - // Remove any existing children. - for (i = numChildren - 1; i >= 0; --i) - { - removeChildAt(i); - } - if (value != null) - { - var n:int = value.operations.length; - - // If there are no operations for this MBean, disable the Operations tab. - if (n == 0) - _tabnav.getTabAt(1).enabled = false; - - // Otherwise, build UI for the set of operations exposed by this MBean. - else - { - _tabnav.getTabAt(1).enabled = true; - for (i = 0; i < n; ++i) - { - var op:Operation = new Operation(this); - addChild(op); - op.operationInfo = value.operations[i]; - } - } - } - } - - /** - * Raises an operation invoke event for a nested Operation. - */ - public function dispatchInvokeEvent(name:String, values:Array, signature:Array):void - { - var event:ManagementOperationInvokeEvent = new ManagementOperationInvokeEvent(_mbeanName, name, values, signature); - dispatchEvent(event); - } - -} - +//////////////////////////////////////////////////////////////////////////////// +// +// 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.events.ManagementOperationInvokeEvent; + +import mx.containers.*; +import mx.messaging.management.MBeanInfo; + +//-------------------------------------- +// Events +//-------------------------------------- + +/** + * Broadcast when a request has been made to invoke an Operation within this OperationSet. + */ +[Event(name="invoke", type="console.events.ManagementOperationInvokeEvent")] + +/** + * The OperationSet is a VBox containing an Operation for each operation exposed by a + * MBean. When the mbeanInfo property is set, the current UI of the OperationSet is torn + * down and new UI is built based upon the MBeanInfo metadata provided. + * + * <p><b>MXML Syntax</b></p> + * + * <p>The <code><mx:OperationSet></code> tag inherits all the properties + * of its parent classes and adds the following properties:</p> + * + * <p> + * <pre> + * <mx:Button + * mbeanInfo="<i>No default</i>." + * /> + * </pre> + * </p> + */ +public class OperationSet extends VBox +{ + //-------------------------------------------------------------------------- + // + // Constructor + // + //-------------------------------------------------------------------------- + + /** + * @private + * Constructor. + */ + public function OperationSet() + { + super(); + } + + + + + //---------------------------------- + // MBeanOperationInfo + //---------------------------------- + + private var _mbeanName:String; + public function set mbeanName(name:String):void + { + _mbeanName = name; + } + + /** + * @private + * Storage for the Mbean info. + */ + private var _mbeanInfo:MBeanInfo; + + /** + * MBean metadata to drive the UI for this component. + */ + public function get mbeanInfo():MBeanInfo + { + return _mbeanInfo; + } + + + private var _tabnav:TabNavigator; + public function set tabnav(p:TabNavigator):void + { + _tabnav = p; + } + + public function set mbeanInfo(value:MBeanInfo):void + { + var i:int; + + _mbeanInfo = value; + // Remove any existing children. + for (i = numChildren - 1; i >= 0; --i) + { + removeChildAt(i); + } + if (value != null) + { + var n:int = value.operations.length; + + // If there are no operations for this MBean, disable the Operations tab. + if (n == 0) + _tabnav.getTabAt(1).enabled = false; + + // Otherwise, build UI for the set of operations exposed by this MBean. + else + { + _tabnav.getTabAt(1).enabled = true; + for (i = 0; i < n; ++i) + { + var op:Operation = new Operation(this); + addChild(op); + op.operationInfo = value.operations[i]; + } + } + } + } + + /** + * Raises an operation invoke event for a nested Operation. + */ + public function dispatchInvokeEvent(name:String, values:Array, signature:Array):void + { + var event:ManagementOperationInvokeEvent = new ManagementOperationInvokeEvent(_mbeanName, name, values, signature); + dispatchEvent(event); + } + +} + } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/012fad7c/attic/apps/ds-console/console/containers/PollableAttributeChart.as ---------------------------------------------------------------------- diff --git a/attic/apps/ds-console/console/containers/PollableAttributeChart.as b/attic/apps/ds-console/console/containers/PollableAttributeChart.as index a8dac5a..a8470c5 100755 --- a/attic/apps/ds-console/console/containers/PollableAttributeChart.as +++ b/attic/apps/ds-console/console/containers/PollableAttributeChart.as @@ -1,42 +1,42 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// 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 mx.charts.LineChart; - import mx.charts.series.LineSeries; - - public class PollableAttributeChart extends LineChart - { - function PollableAttributeChart(provider:Object):void - { - super(); - - dataProvider = provider; - this.percentHeight = 100; - this.percentWidth = 100; - - var series:LineSeries = new LineSeries; - series.dataProvider = provider; - series.yField = "value"; - this.addChild(series); - - initialize(); - } - } +//////////////////////////////////////////////////////////////////////////////// +// +// 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 mx.charts.LineChart; + import mx.charts.series.LineSeries; + + public class PollableAttributeChart extends LineChart + { + function PollableAttributeChart(provider:Object):void + { + super(); + + dataProvider = provider; + this.percentHeight = 100; + this.percentWidth = 100; + + var series:LineSeries = new LineSeries; + series.dataProvider = provider; + series.yField = "value"; + this.addChild(series); + + initialize(); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/012fad7c/attic/apps/ds-console/console/containers/ServerManager.as ---------------------------------------------------------------------- diff --git a/attic/apps/ds-console/console/containers/ServerManager.as b/attic/apps/ds-console/console/containers/ServerManager.as index f0ba870..719556c 100755 --- a/attic/apps/ds-console/console/containers/ServerManager.as +++ b/attic/apps/ds-console/console/containers/ServerManager.as @@ -1,138 +1,138 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// 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.collections.ArrayCollection; - import mx.events.ListEvent; - import flash.events.Event; - import mx.charts.LineChart; - import mx.charts.series.LineSeries; - import mx.utils.ObjectProxy; - import flash.utils.setInterval; - import mx.collections.ICollectionView; - import console.data.Bindable3DHashMap; - import flash.events.TextEvent; - import console.events.ManagementOperationInvokeEvent; - import mx.controls.DataGrid; - import mx.events.DataGridEvent; - import mx.events.FlexEvent; - - public class ServerManager extends UpdateListener - { - private var _manager:ConsoleManager; - private var display:ServerManagerDisplay; - private var dataCache:Bindable3DHashMap; - private var pollableAttributes:Object; - private var visibleTypes:Array; - - public function ServerManager():void - { - super(); - display = new ServerManagerDisplay; - this.addChild(display); - - this.label = "Server Management"; - display.scalarProperties.addEventListener(ListEvent.CHANGE, selectedScalar); - display.pollableProperties.addEventListener(ListEvent.CHANGE, selectedPollable); - _manager = ConsoleManager.getInstance(); - _manager.registerListener(this, [{type: ConsoleManager.GENERAL_OPERATION, poll: false}, - {type: ConsoleManager.GENERAL_SERVER, poll: false}, - {type: ConsoleManager.GENERAL_POLLABLE, poll: true}]); - setupDataCache(); - } - - 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(String(type), propertyArrayForMBean[i].name, propertyArrayForMBean[i].value); - } - } - - if (type == ConsoleManager.GENERAL_POLLABLE) - pollableAttributes = data; - } - - private function setupDataCache():void - { - dataCache = new Bindable3DHashMap(); - dataCache.update(String(ConsoleManager.GENERAL_OPERATION),null,null); - dataCache.update(String(ConsoleManager.GENERAL_POLLABLE),null,null); - dataCache.update(String(ConsoleManager.GENERAL_SERVER),null,null); - - display.scalarProperties.dataProvider = dataCache.getBindableKeyArray(String(ConsoleManager.GENERAL_SERVER)); - display.pollableProperties.dataProvider = dataCache.getBindableKeyArray(String(ConsoleManager.GENERAL_POLLABLE)); - } - - private function invokeOp(mbean:String, operation:String, value:String):void - { - _manager.invokeOperation( - new ManagementOperationInvokeEvent(mbean, operation, [value], ["java.lang.String"]), - function (e:Event):void { - - } - ); - } - - private function selectedScalar(e:Event):void - { - // It's possible that the data has changed since it was clicked because of polling - // if the selected item is null, then return. - // TODO: Handle this more gracefully. - if (display.scalarProperties.selectedItem == -1) return; - - var attr:String = display.scalarProperties.selectedItem.propertyName; - var mbean:String = display.scalarProperties.selectedItem.mbeanName; - display.selectedProperty.text = attr; - display.pollableProperties.selectedIndex = -1; - } - - private function selectedPollable(e:Event):void - { - // It's possible that the data has changed since it was clicked because of polling - // if the selected item is null, then return. - // TODO: Handle this more gracefully. - if (display.pollableProperties.selectedItem == null) return; - - var attr:String = display.pollableProperties.selectedItem.Property - display.selectedProperty.text = attr; - - display.attrgraph.dataProvider = dataCache.getBindableDataArray(String(ConsoleManager.GENERAL_POLLABLE), attr); - display.attrgraphSeries.dataProvider = dataCache.getBindableDataArray(String(ConsoleManager.GENERAL_POLLABLE), attr); - display.scalarProperties.selectedIndex = -1; - } - - public override function appChanged(s:String):void - { - display.attrgraph.dataProvider = null; - display.attrgraphSeries.dataProvider = null; - display.selectedProperty.text = "None"; - setupDataCache(); - _manager.updateData(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.collections.ArrayCollection; + import mx.events.ListEvent; + import flash.events.Event; + import mx.charts.LineChart; + import mx.charts.series.LineSeries; + import mx.utils.ObjectProxy; + import flash.utils.setInterval; + import mx.collections.ICollectionView; + import console.data.Bindable3DHashMap; + import flash.events.TextEvent; + import console.events.ManagementOperationInvokeEvent; + import mx.controls.DataGrid; + import mx.events.DataGridEvent; + import mx.events.FlexEvent; + + public class ServerManager extends UpdateListener + { + private var _manager:ConsoleManager; + private var display:ServerManagerDisplay; + private var dataCache:Bindable3DHashMap; + private var pollableAttributes:Object; + private var visibleTypes:Array; + + public function ServerManager():void + { + super(); + display = new ServerManagerDisplay; + this.addChild(display); + + this.label = "Server Management"; + display.scalarProperties.addEventListener(ListEvent.CHANGE, selectedScalar); + display.pollableProperties.addEventListener(ListEvent.CHANGE, selectedPollable); + _manager = ConsoleManager.getInstance(); + _manager.registerListener(this, [{type: ConsoleManager.GENERAL_OPERATION, poll: false}, + {type: ConsoleManager.GENERAL_SERVER, poll: false}, + {type: ConsoleManager.GENERAL_POLLABLE, poll: true}]); + setupDataCache(); + } + + 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(String(type), propertyArrayForMBean[i].name, propertyArrayForMBean[i].value); + } + } + + if (type == ConsoleManager.GENERAL_POLLABLE) + pollableAttributes = data; + } + + private function setupDataCache():void + { + dataCache = new Bindable3DHashMap(); + dataCache.update(String(ConsoleManager.GENERAL_OPERATION),null,null); + dataCache.update(String(ConsoleManager.GENERAL_POLLABLE),null,null); + dataCache.update(String(ConsoleManager.GENERAL_SERVER),null,null); + + display.scalarProperties.dataProvider = dataCache.getBindableKeyArray(String(ConsoleManager.GENERAL_SERVER)); + display.pollableProperties.dataProvider = dataCache.getBindableKeyArray(String(ConsoleManager.GENERAL_POLLABLE)); + } + + private function invokeOp(mbean:String, operation:String, value:String):void + { + _manager.invokeOperation( + new ManagementOperationInvokeEvent(mbean, operation, [value], ["java.lang.String"]), + function (e:Event):void { + + } + ); + } + + private function selectedScalar(e:Event):void + { + // It's possible that the data has changed since it was clicked because of polling + // if the selected item is null, then return. + // TODO: Handle this more gracefully. + if (display.scalarProperties.selectedItem == -1) return; + + var attr:String = display.scalarProperties.selectedItem.propertyName; + var mbean:String = display.scalarProperties.selectedItem.mbeanName; + display.selectedProperty.text = attr; + display.pollableProperties.selectedIndex = -1; + } + + private function selectedPollable(e:Event):void + { + // It's possible that the data has changed since it was clicked because of polling + // if the selected item is null, then return. + // TODO: Handle this more gracefully. + if (display.pollableProperties.selectedItem == null) return; + + var attr:String = display.pollableProperties.selectedItem.Property + display.selectedProperty.text = attr; + + display.attrgraph.dataProvider = dataCache.getBindableDataArray(String(ConsoleManager.GENERAL_POLLABLE), attr); + display.attrgraphSeries.dataProvider = dataCache.getBindableDataArray(String(ConsoleManager.GENERAL_POLLABLE), attr); + display.scalarProperties.selectedIndex = -1; + } + + public override function appChanged(s:String):void + { + display.attrgraph.dataProvider = null; + display.attrgraphSeries.dataProvider = null; + display.selectedProperty.text = "None"; + setupDataCache(); + _manager.updateData(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/ServerManagerDisplay.mxml ---------------------------------------------------------------------- diff --git a/attic/apps/ds-console/console/containers/ServerManagerDisplay.mxml b/attic/apps/ds-console/console/containers/ServerManagerDisplay.mxml index 4161a3b..2bf1152 100755 --- a/attic/apps/ds-console/console/containers/ServerManagerDisplay.mxml +++ b/attic/apps/ds-console/console/containers/ServerManagerDisplay.mxml @@ -1,54 +1,54 @@ -<?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:Panel xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"> - <mx:HDividedBox width="100%" height="100%"> - <mx:VBox height="100%" width="400"> - <mx:DataGrid id="scalarProperties" width="100%"> - <mx:columns> - <mx:DataGridColumn dataField="mbeanName" visible="false" /> - <mx:DataGridColumn headerText="Scalar Property" dataField="Property" /> - <mx:DataGridColumn headerText="Value" dataField="Value" /> - </mx:columns> - </mx:DataGrid> - <mx:DataGrid id="pollableProperties" width="100%"> - <mx:columns> - <mx:DataGridColumn dataField="mbeanName" visible="false" /> - <mx:DataGridColumn headerText="Graphable Property" dataField="Property" /> - <mx:DataGridColumn headerText="Value" dataField="Value" /> - </mx:columns> - </mx:DataGrid> - </mx:VBox> - <mx:VDividedBox height="100%"> - <mx:HBox> - <mx:Label text="Selected Attribute" /> - <mx:Text id="selectedProperty" /> - </mx:HBox> - <mx:LineChart id="attrgraph" width="100%" height="100%"> - <mx:verticalAxis> - <mx:LinearAxis id="attrgraphAxis" baseAtZero="false" /> - </mx:verticalAxis> - <mx:series> - <mx:LineSeries id="attrgraphSeries" yField="Value" /> - </mx:series> - </mx:LineChart> - </mx:VDividedBox> - </mx:HDividedBox> - -</mx:Panel> +<?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:Panel xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"> + <mx:HDividedBox width="100%" height="100%"> + <mx:VBox height="100%" width="400"> + <mx:DataGrid id="scalarProperties" width="100%"> + <mx:columns> + <mx:DataGridColumn dataField="mbeanName" visible="false" /> + <mx:DataGridColumn headerText="Scalar Property" dataField="Property" /> + <mx:DataGridColumn headerText="Value" dataField="Value" /> + </mx:columns> + </mx:DataGrid> + <mx:DataGrid id="pollableProperties" width="100%"> + <mx:columns> + <mx:DataGridColumn dataField="mbeanName" visible="false" /> + <mx:DataGridColumn headerText="Graphable Property" dataField="Property" /> + <mx:DataGridColumn headerText="Value" dataField="Value" /> + </mx:columns> + </mx:DataGrid> + </mx:VBox> + <mx:VDividedBox height="100%"> + <mx:HBox> + <mx:Label text="Selected Attribute" /> + <mx:Text id="selectedProperty" /> + </mx:HBox> + <mx:LineChart id="attrgraph" width="100%" height="100%"> + <mx:verticalAxis> + <mx:LinearAxis id="attrgraphAxis" baseAtZero="false" /> + </mx:verticalAxis> + <mx:series> + <mx:LineSeries id="attrgraphSeries" yField="Value" /> + </mx:series> + </mx:LineChart> + </mx:VDividedBox> + </mx:HDividedBox> + +</mx:Panel> http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/012fad7c/attic/apps/ds-console/console/containers/UpdateListener.as ---------------------------------------------------------------------- diff --git a/attic/apps/ds-console/console/containers/UpdateListener.as b/attic/apps/ds-console/console/containers/UpdateListener.as index ae30465..bd3a464 100755 --- a/attic/apps/ds-console/console/containers/UpdateListener.as +++ b/attic/apps/ds-console/console/containers/UpdateListener.as @@ -1,109 +1,109 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// 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 mx.containers.Canvas; - import console.data.Bindable3DHashMap; - import mx.collections.ArrayCollection; - import mx.messaging.management.ObjectName; - - public class UpdateListener extends Canvas - { - protected var _name:String; - protected var _model:Object; - - /** - * Invoked when the names of the mbeans are retrieved from the server. - */ - public function mbeanModelUpdate(mbeanModel:Object):void - { - - } - - /** - * Invoked when the data for a given type is updated if the implementing class - * is registered with the ConsoleManager for the type, and if the implementing class - * is set to active in the ConsoleManager. - */ - public function dataUpdate(type:int, data:Object):void - { - - } - - /** - * Invoked when the selected application has changed. An implementing class might - * want to clear any data it is holding onto since the data will be belonging to - * objects in an application's MBeans that are no longer being queried. - */ - public function appChanged(s:String):void - { - - } - - /** - * If the container only wishes to query a select number of MBeans upon dataUpdate, they should be - * visible in a map keyed on the display type containing arrays of the MBean names. - * - * If a null value, or any object that the ConsoleManager can't parse, then all - * MBeans for all active types are returned upon dataUpdate. - */ - public function get specificMBeansMap():Object - { - return null; - } - - protected function traverseTreeForObject(node:Object, searchType:String = null, searchObject:String = null):Object - { - if (node == null) - { - return null; - } - else if (node.hasOwnProperty("type")) - { - // Node is a container of objects of 'type' - if (searchType != null) - { - if (node.type == searchObject) - return node; - } - } - else if (node.hasOwnProperty("objectName")) - { - // Node is a specific object, an instance of parent 'type' - if (searchObject != null) - { - if ((node.objectName as ObjectName).getKeyProperty("id") == searchObject) - return node; - } - } - - // recur - if (node.hasOwnProperty("children") && (node.children is Array)) - { - for each (var child:Object in (node.children as Array)) - { - traverseTreeForObject(child, searchType, searchObject); - } - } - - // not found - return 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 mx.containers.Canvas; + import console.data.Bindable3DHashMap; + import mx.collections.ArrayCollection; + import mx.messaging.management.ObjectName; + + public class UpdateListener extends Canvas + { + protected var _name:String; + protected var _model:Object; + + /** + * Invoked when the names of the mbeans are retrieved from the server. + */ + public function mbeanModelUpdate(mbeanModel:Object):void + { + + } + + /** + * Invoked when the data for a given type is updated if the implementing class + * is registered with the ConsoleManager for the type, and if the implementing class + * is set to active in the ConsoleManager. + */ + public function dataUpdate(type:int, data:Object):void + { + + } + + /** + * Invoked when the selected application has changed. An implementing class might + * want to clear any data it is holding onto since the data will be belonging to + * objects in an application's MBeans that are no longer being queried. + */ + public function appChanged(s:String):void + { + + } + + /** + * If the container only wishes to query a select number of MBeans upon dataUpdate, they should be + * visible in a map keyed on the display type containing arrays of the MBean names. + * + * If a null value, or any object that the ConsoleManager can't parse, then all + * MBeans for all active types are returned upon dataUpdate. + */ + public function get specificMBeansMap():Object + { + return null; + } + + protected function traverseTreeForObject(node:Object, searchType:String = null, searchObject:String = null):Object + { + if (node == null) + { + return null; + } + else if (node.hasOwnProperty("type")) + { + // Node is a container of objects of 'type' + if (searchType != null) + { + if (node.type == searchObject) + return node; + } + } + else if (node.hasOwnProperty("objectName")) + { + // Node is a specific object, an instance of parent 'type' + if (searchObject != null) + { + if ((node.objectName as ObjectName).getKeyProperty("id") == searchObject) + return node; + } + } + + // recur + if (node.hasOwnProperty("children") && (node.children is Array)) + { + for each (var child:Object in (node.children as Array)) + { + traverseTreeForObject(child, searchType, searchObject); + } + } + + // not found + return 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/UpdateManager.as ---------------------------------------------------------------------- diff --git a/attic/apps/ds-console/console/containers/UpdateManager.as b/attic/apps/ds-console/console/containers/UpdateManager.as index 2883c59..1f6d7ec 100755 --- a/attic/apps/ds-console/console/containers/UpdateManager.as +++ b/attic/apps/ds-console/console/containers/UpdateManager.as @@ -1,28 +1,28 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// 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 -{ - public interface UpdateManager - { - function registerListener(listner:UpdateListener, types:Array):void; - function unregisterListener(listner:UpdateListener):void; - function activateListener(listener:UpdateListener):void; - function deactivateListener(listener:UpdateListener):void; - } +//////////////////////////////////////////////////////////////////////////////// +// +// 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 +{ + public interface UpdateManager + { + function registerListener(listner:UpdateListener, types:Array):void; + function unregisterListener(listner:UpdateListener):void; + function activateListener(listener:UpdateListener):void; + function deactivateListener(listener:UpdateListener):void; + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/012fad7c/attic/apps/ds-console/console/data/Bindable3DHashMap.as ---------------------------------------------------------------------- diff --git a/attic/apps/ds-console/console/data/Bindable3DHashMap.as b/attic/apps/ds-console/console/data/Bindable3DHashMap.as index d7b056f..5e4088f 100755 --- a/attic/apps/ds-console/console/data/Bindable3DHashMap.as +++ b/attic/apps/ds-console/console/data/Bindable3DHashMap.as @@ -1,110 +1,110 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// 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.data -{ - import mx.collections.ArrayCollection; - import mx.utils.ObjectProxy; - import flash.events.Event; - import mx.events.PropertyChangeEvent; - import mx.events.CollectionEvent; - import mx.controls.listClasses.ListBase; - - public class Bindable3DHashMap - { - public var objects:ObjectProxy; - public var objectsForKeyArray:ObjectProxy; - - public function Bindable3DHashMap() - { - objects = new ObjectProxy; - objectsForKeyArray = new ObjectProxy; - } - - public function updateNoPollable(object:String, key:String, value:*):void - { - if (!objectsForKeyArray.hasOwnProperty(object)) - objectsForKeyArray[object] = new ArrayCollection; - - if (!key) - return; - - var keysForKeyArray:ArrayCollection = objectsForKeyArray[object] as ArrayCollection; - - var foundKey:Boolean = false; - for (var i:int = 0; i < keysForKeyArray.length; i++) - { - if ((keysForKeyArray[i].hasOwnProperty("Property")) && (keysForKeyArray[i]["Property"] == key)) - { - keysForKeyArray[i]["Value"] = value; - foundKey = true; - break; - } - } - - if (!foundKey) - keysForKeyArray.addItem({Property: key, Value:value}); - - keysForKeyArray.dispatchEvent(new CollectionEvent(CollectionEvent.COLLECTION_CHANGE)); - } - - public function update(object:String, key:String, value:*):void - { - if (!objects.hasOwnProperty(object)) - { - objects[object] = new ObjectProxy; - } - - if (!key) - return; - - var keys:ObjectProxy = objects[object] as ObjectProxy; - - if (!keys.hasOwnProperty(key)) - keys[key] = new ArrayCollection; - - (keys[key] as ArrayCollection).addItem({Name: key, Value: value}); - (keys[key] as ArrayCollection).dispatchEvent(new CollectionEvent(CollectionEvent.COLLECTION_CHANGE)); - - updateNoPollable(object, key, value); - } - - public function getBindableKeyArray(object:String):ArrayCollection - { - if (!objectsForKeyArray.hasOwnProperty(object)) - objectsForKeyArray[object] = new ArrayCollection; - - return (objectsForKeyArray[object] as ArrayCollection); - } - - public function getBindableDataArray(object:String, key:String):ArrayCollection - { - if (!objects.hasOwnProperty(object)) - objects[object] = new ObjectProxy; - - var keys:ObjectProxy = objects[object] as ObjectProxy; - return keys[key] as ArrayCollection; - } - - public function clearData():void - { - objects = new ObjectProxy; - objectsForKeyArray = new ObjectProxy; - } - } +//////////////////////////////////////////////////////////////////////////////// +// +// 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.data +{ + import mx.collections.ArrayCollection; + import mx.utils.ObjectProxy; + import flash.events.Event; + import mx.events.PropertyChangeEvent; + import mx.events.CollectionEvent; + import mx.controls.listClasses.ListBase; + + public class Bindable3DHashMap + { + public var objects:ObjectProxy; + public var objectsForKeyArray:ObjectProxy; + + public function Bindable3DHashMap() + { + objects = new ObjectProxy; + objectsForKeyArray = new ObjectProxy; + } + + public function updateNoPollable(object:String, key:String, value:*):void + { + if (!objectsForKeyArray.hasOwnProperty(object)) + objectsForKeyArray[object] = new ArrayCollection; + + if (!key) + return; + + var keysForKeyArray:ArrayCollection = objectsForKeyArray[object] as ArrayCollection; + + var foundKey:Boolean = false; + for (var i:int = 0; i < keysForKeyArray.length; i++) + { + if ((keysForKeyArray[i].hasOwnProperty("Property")) && (keysForKeyArray[i]["Property"] == key)) + { + keysForKeyArray[i]["Value"] = value; + foundKey = true; + break; + } + } + + if (!foundKey) + keysForKeyArray.addItem({Property: key, Value:value}); + + keysForKeyArray.dispatchEvent(new CollectionEvent(CollectionEvent.COLLECTION_CHANGE)); + } + + public function update(object:String, key:String, value:*):void + { + if (!objects.hasOwnProperty(object)) + { + objects[object] = new ObjectProxy; + } + + if (!key) + return; + + var keys:ObjectProxy = objects[object] as ObjectProxy; + + if (!keys.hasOwnProperty(key)) + keys[key] = new ArrayCollection; + + (keys[key] as ArrayCollection).addItem({Name: key, Value: value}); + (keys[key] as ArrayCollection).dispatchEvent(new CollectionEvent(CollectionEvent.COLLECTION_CHANGE)); + + updateNoPollable(object, key, value); + } + + public function getBindableKeyArray(object:String):ArrayCollection + { + if (!objectsForKeyArray.hasOwnProperty(object)) + objectsForKeyArray[object] = new ArrayCollection; + + return (objectsForKeyArray[object] as ArrayCollection); + } + + public function getBindableDataArray(object:String, key:String):ArrayCollection + { + if (!objects.hasOwnProperty(object)) + objects[object] = new ObjectProxy; + + var keys:ObjectProxy = objects[object] as ObjectProxy; + return keys[key] as ArrayCollection; + } + + public function clearData():void + { + objects = new ObjectProxy; + objectsForKeyArray = new ObjectProxy; + } + } } \ No newline at end of file
