Added: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/QueryBuilder.js URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/QueryBuilder.js?rev=1736622&view=auto ============================================================================== --- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/QueryBuilder.js (added) +++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/QueryBuilder.js Fri Mar 25 17:55:39 2016 @@ -0,0 +1,632 @@ +/* + * + * 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. + * + */ +define(["dojo/_base/declare", + "dojo/_base/lang", + "dojo/parser", + "dojo/dom-construct", + "dojo/text!query/QueryBuilder.html", + "dojox/html/entities", + "dgrid/Grid", + "dgrid/Keyboard", + "dgrid/Selection", + "dgrid/extensions/Pagination", + "dgrid/Selector", + "dstore/Memory", + 'dstore/legacy/DstoreAdapter', + "qpid/management/query/ColumnsSelector", + "qpid/management/query/WhereCriteria", + "dijit/popup", + "qpid/common/FormWidgetMixin", + "dijit/_Widget", + "dijit/_TemplatedMixin", + "dijit/_WidgetsInTemplateMixin", + "dijit/form/FilteringSelect", + "dijit/form/ComboBox", + "dijit/form/Button", + "dijit/form/ComboButton", + "dijit/form/CheckBox", + "dijit/form/DropDownButton", + "dijit/form/NumberTextBox", + "dijit/form/ValidationTextBox", + "dijit/form/Select", + "dijit/Menu", + "dijit/MenuItem", + "dijit/Toolbar", + "dijit/TooltipDialog", + "dijit/Dialog", + "dojo/Deferred", + "dojo/json" + ], + function(declare, + lang, + parser, + domConstruct, + template, + entities, + Grid, + Keyboard, + Selection, + Pagination, + Selector, + Memory, + DstoreAdapter, + ColumnsSelector, + WhereCriteria, + popup + ) + { + return declare( "qpid.management.query.QueryBuilder", + [dijit._Widget, dijit._TemplatedMixin, dijit._WidgetsInTemplateMixin], + { + //Strip out the apache comment header from the template html as comments unsupported. + templateString: template.replace(/<!--[\s\S]*?-->/g, ""), + _select: "", + _where: [], + _whereItems: {}, + _standardMode: true, + constructor: function(args) + { + this._management = args.management; + this.inherited(arguments); + }, + postCreate: function() + { + this.inherited(arguments); + this._postCreate(); + }, + _postCreate: function() + { + this._createCategoryList(); + var that = this; + this.searchButton.on("click", function(e){ that.search()}); + this.selectCriteria.set("value", this._select); + this.selectCriteria.on("change", function(){that._advancedModeSelectCriteriaChanged();}); + this.selectCriteria.on("keyUp", function(e){that._keyPressed(e);}); + this.whereCriteria.on("change", function(){that._advancedModeWhereCriteriaChanged();}); + this.whereCriteria.on("keyUp", function(e){that._keyPressed(e);}); + this.modeButton.on("click", function(e){that._modeChanged();}); + this._virtualHostWidget = this._createScopeList(); + this._selectChooser = new ColumnsSelector({onDone: function(result) + { + popup.close(that.columnsDialog); + that._setSelectedAttr(result); + that.search(); + }, + onCancel:function(result) + { + popup.close(that.columnsDialog); + } + }, this.selectPanel); + this.columnsDialog.set("content", this._selectChooser); + + this._whereChooser = new ColumnsSelector({onDone: function(result) + { + popup.close(that.conditionsDialog); + that._setWhereAttr(result); + that.search(); + }, + onCancel:function(result) + { + popup.close(that.conditionsDialog); + } + }, this.wherePanel); + this.conditionsDialog.set("content", this._whereChooser); + + // startup buttons to create dropDown fields + this.conditionsButton.startup(); + this.columnsButton.startup(); + this.modeButton.set("checked", false) + this._categoryChanged(); + this._criteriaChanged(); + }, + search: function() + { + if (this.selectCriteria.value) + { + if (!this._standardMode) + { + this._selectChooser.set("selected", this._getSelectItems()); + if (this._lastStandardModeWhereExpression && this._lastStandardModeWhereExpression != this.whereCriteria.value) + { + this._lastStandardModeWhereExpression = ""; + this._clearWhereCriteria(); + this._where = []; + this._whereItems ={} + this._whereChooser.set("selected", []); + } + } + var modelObj = this._scopeModelObjects[this._searchScopeList.value]; + this._doSearch( modelObj, + this._categoryList.value.toLowerCase(), + this.selectCriteria.value, + this._standardMode ? this._lastStandardModeWhereExpression : this.whereCriteria.value); + } + }, + _doSearch: function(modelObj, category, select, where) + { + var that = this; + var result = this._management.query({select: select, + where: where, + parent: modelObj, + category: category, + transformIntoObjects: true}); + result.then(function(data) + { + that._showResults(data, select); + }, + function(error) + { + if (error && error.response && error.response.status == 404) + { + that._showResults([], select); + } + else + { + alert(error.message ? error.message: error); + } + }); + }, + _advancedModeWhereCriteriaChanged: function() + { + this._criteriaChanged(); + if (this._lastStandardModeWhereExpression) + { + dijit.showTooltip("On switching into Standard Mode where expression" + + " will be erased. Copying of where expression from " + + " Advanced Mode in Standard Mode is unsupported!", + this.whereCriteria.domNode, + this.whereCriteria.get("tooltipPosition"), + !this.whereCriteria.isLeftToRight()); + } + }, + _advancedModeSelectCriteriaChanged: function() + { + this._criteriaChanged(); + this._setSelectedAttr(this.selectCriteria.value); + }, + _showResults:function(data, select) + { + var store = new Memory({data: data, idProperty: 'id'}); + if (!this._resultsGrid) + { + this._buildGrid(store, select); + } + else + { + this._resultsGrid.set("collection", store); + this._resultsGrid.set("columns", this._getColumns(select)); + this._resultsGrid.refresh(); + } + }, + _buildGrid: function(store, select) + { + var CustomGrid = declare([ Grid, Keyboard, Selection, Pagination ]); + var grid = new CustomGrid({ + columns: this._getColumns(select), + collection: store, + rowsPerPage: 100, + selectionMode: 'single', + cellNavigation: false, + className: 'dgrid-autoheight' + }, + this.queryResultGrid); + this._resultsGrid = grid; + this._resultsGrid.startup(); + this._resultsGrid.on('.dgrid-row:dblclick', lang.hitch(this, this._onRowClick)); + }, + _onRowClick: function (event) + { + var row = this._resultsGrid.row(event); + var promise = this._management.get({url:"service/structure"}); + var that = this; + promise.then(function (data) + { + var findObject = function findObject(structure, parent, type) + { + var item = {id:structure.id, + name: structure.name, + type: type, + parent: parent}; + if (item.id == row.id) + { + return item; + } + else + { + for(var fieldName in structure) + { + var fieldValue = structure[fieldName]; + if (lang.isArray(fieldValue)) + { + var fieldType = fieldName.substring(0, fieldName.length - 1); + for (var i = 0; i < fieldValue.length; i++) + { + var object = fieldValue[i]; + var result = findObject(object, item, fieldType); + if (result != null) + { + return result; + } + } + } + } + return null; + } + }; + + var item = findObject(data, null, "broker"); + if (item != null) + { + that.controller.show(item.type, item.name, item.parent, item.id); + } + }); + }, + _getColumns: function(select) + { + select = select || this._select; + var columns = {}; + var attributes = select.split(","); + for (var i in attributes) + { + var attribute = attributes[i].replace(/^\s+|\s+$/gm,''); + columns[attribute] = attribute; + } + return columns; + }, + _createScopeList: function() + { + var that = this; + var result = this._management.query({select: "$parent.name, name, id", + category : "virtualhost", + transformIntoObjects: true}); + var deferred = new dojo.Deferred(); + result.then(function(data) + { + that._scopeModelObjects = {}; + var defaultValue = undefined; + var items = [{id:undefined, name: "Broker"}]; + for(var i =0 ; i<data.length;i++) + { + var name = data[i].name; + var parentName = data[i]["$parent.name"]; + items.push({id: data[i].id, name: "VH:" + parentName + "/" + name}); + that._scopeModelObjects[data[i].id] = {name: name, + type: "virtualhost", + parent: {name: parentName, + type: "virtualhostnode", + parent: {type: "broker"} + } + }; + if (that.parentModelObj && + that.parentModelObj.type == "virtualhost" && + that.parentModelObj.name == name && + that.parentModelObj.parent && + that.parentModelObj.parent.name == parentName) + { + defaultValue = data[i].id; + } + } + try + { + var scopeStore = new DstoreAdapter (new Memory({data: items, idProperty: 'id'})); + that._searchScopeList = new dijit.form.FilteringSelect({ + name: "scope", + placeHolder: "Select search scope", + store: scopeStore, + value: defaultValue, + required: false, + "class": "queryDefaultField" + }, + that.scope); + that._searchScopeList.startup(); + } + finally + { + deferred.resolve(that._searchScopeList); + } + }, + function(error) + { + deferred.reject(null); + console.error(error.message ? error.message : error); + }); + return deferred.promise; + }, + _createCategoryList: function() + { + var predefinedCategories = [ + {id: "queue", name: "queue"}, + {id: "connection", name: "connection"} + ]; + var categoryStore = new DstoreAdapter (new Memory({ idProperty: "id", + data: predefinedCategories})); + this._categoryList = new dijit.form.ComboBox({ + name: "category", + placeHolder: "Select Category", + store: categoryStore, + value: this._category || "queue", + required: true, + invalidMessage: "Invalid category specified", + "class": "queryDefaultField" + }, + this.categoryName); + this._categoryList.startup(); + this._categoryList.on("change", lang.hitch(this, this._categoryChanged)); + }, + _categoryChanged: function() + { + var metadata = this._getCategoryMetadata(); + var disableMetadataDependant = !metadata; + this.conditionsButton.set("disabled", disableMetadataDependant); + this.columnsButton.set("disabled", disableMetadataDependant); + this.searchButton.set("disabled", disableMetadataDependant); + if (disableMetadataDependant) + { + dijit.showTooltip( + this._categoryList.get("invalidMessage"), + this._categoryList.domNode, + this._categoryList.get("tooltipPosition"), + !this._categoryList.isLeftToRight() + ); + } + else + { + if (this._lastCategory != this._categoryList.value) + { + this._lastCategory = this._categoryList.value; + this.selectCriteria.set("value", ""); + this._selected = ""; + this._showResults([], this._selected); + var columns = this._extractColumnsFromMetadata(metadata); + this.whereCriteria.set("value", ""); + this._clearWhereCriteria(); + this._where = []; + this._whereItems ={} + this._whereChooser.updateData(columns, []); + this._selectChooser.updateData(columns, []); + } + } + }, + _criteriaChanged: function() + { + var criteriaNotSet = !this.selectCriteria.value; + this.searchButton.set("disabled",criteriaNotSet); + this.searchButton.set("title",criteriaNotSet?"Please, choose fields to display in order to enable search":"Search"); + }, + _keyPressed:function(evt) + { + var key = evt.keyCode; + if (key == dojo.keys.ENTER && this.selectCriteria.value) + { + this.search(); + } + }, + _modeChanged: function() + { + this._standardMode = !this._standardMode + if (!this._standardMode) + { + this.modeButton.set("label", "Standard"); + this.modeButton.set("title", "Switch to 'Standard' search"); + this.selectCriteria.set("disabled", false); + this.whereCriteria.set("disabled", false); + this.standardSearchTools.style.display = "none"; + this.standardModeConditionsToolbar.domNode.style.display = "none"; + this.advancedSearch.style.display = ""; + } + else + { + this.modeButton.set("label", "Advanced"); + this.modeButton.set("title", "Switch to 'Advanced' search using SQL-like expressions"); + this.selectCriteria.set("disabled", true); + this.whereCriteria.set("disabled", true); + this.standardSearchTools.style.display = ""; + this.standardModeConditionsToolbar.domNode.style.display = ""; + this.advancedSearch.style.display = "none"; + } + }, + _getCategoryMetadata: function() + { + if (this._categoryList.value) + { + var category = this._categoryList.value.charAt(0).toUpperCase() + this._categoryList.value.substring(1); + return this._management.metadata.metadata[category]; + } + else + { + return undefined; + } + }, + _getSelectItems: function() + { + var columns = []; + if (this.selectCriteria.value) + { + var attributes = this.selectCriteria.value.split(","); + for (var i in attributes) + { + var attribute = attributes[i].replace(/^\s+|\s+$/gm,''); + columns.push(attribute); + } + } + return columns; + }, + _setSelectedAttr: function(value) + { + var val = value; + if (lang.isArray( value )) + { + val = ""; + for(var i=0;i<value.length;i++) + { + val = val + (i> 0 ? "," : "") + (value[i].attributeName ? value[i].attributeName : value[i]); + } + } + this._selected = val; + this.selectCriteria.set("value", val); + }, + _getWhereItems: function() + { + var selected = []; + for(var i =0; i< this._where.length; i++) + { + var id = this._where[i].id; + selected.push(id); + } + return selected; + }, + _setWhereAttr: function(items) + { + this._where = items; + this._buildWhereCriteriaWidgets(items); + }, + _buildWhereCriteriaWidgets: function(items) + { + for(var i =0; i< items.length; i++) + { + var name = items[i].attributeName; + if (!(name in this._whereItems)) + { + this._whereItems[name] = this._createWhereCriteriaWidget(items[i]); + } + } + }, + _createWhereCriteriaWidget: function(item) + { + var whereCriteria = null; + var widgetNode = domConstruct.create("div"); + whereCriteria = new WhereCriteria({attributeDetails: item, + onChange: lang.hitch(this,this._standardModeWhereChanged)}, + widgetNode); + this.standardModeConditionsToolbar.addChild(whereCriteria); + whereCriteria.startup(); + return whereCriteria; + + }, + _standardModeWhereChanged:function() + { + var columnsAfterChange = []; + var whereExpression = ""; + var children = this.standardModeConditionsToolbar.getChildren(); + for(var i=0;i<children.length;i++) + { + var details = children[i].getAttributeDetails(); + columnsAfterChange.push(details); + var expression = children[i].getConditionExpression(); + if (expression) + { + whereExpression = whereExpression + (whereExpression ? " and " : "") + expression; + } + } + + // find deleted widgets + var deletedFound = false; + var columnsBeforeChange = this._where.slice(0); + for(var j=columnsBeforeChange.length - 1;j>=0;j--) + { + var index = -1; + for(var i=0;i<columnsAfterChange.length;i++) + { + if (columnsBeforeChange[j].attributeName == columnsAfterChange[i].attributeName) + { + index = j; + break; + } + } + if (index == -1) + { + delete this._whereItems[columnsBeforeChange[j].attributeName]; + deletedFound = true; + } + } + this._where = columnsAfterChange; + this.whereCriteria.set("value", whereExpression); + this._lastStandardModeWhereExpression = whereExpression; + if (deletedFound) + { + this._whereChooser.set("selected", this._getWhereItems()); + } + this.search(); + }, + _clearWhereCriteria: function() + { + this._whereItems = {}; + this._where = []; + var children = this.standardModeConditionsToolbar.getChildren(); + for(var i=children.length-1;i>=0;i--) + { + children[i].destroyRecursive(false); + } + }, + _extractColumnsFromMetadata: function(metadata) + { + var columns = []; + var helper = {}; + var validTypes = []; + var typeAttribute = null; + for(var i in metadata) + { + validTypes.push(i); + var categoryType = metadata[i]; + var attributes = categoryType.attributes; + for(var name in attributes) + { + var attribute = attributes[name]; + if (!(name in helper)) + { + helper[name] = true; + var attributeData = {id: name, + attributeName: name, + type: attribute.type, + validValues: attribute.validValues, + description: attribute.description, + columnType: "attribute"}; + if (name === "type") + { + typeAttribute = attributeData; + } + columns.push(attributeData ); + } + } + + var statistics = categoryType.statistics; + for(var name in statistics) + { + var statistic = statistics[name]; + if (!(name in helper)) + { + helper[name] = true; + columns.push( {id: name, + attributeName: name, + type: statistic.type, + description: statistic.description, + columnType: "statistics"}); + } + } + } + if (typeAttribute != null && !typeAttribute.validValues) + { + typeAttribute.validValues = validTypes; + } + return columns; + } + }); + });
Added: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/WhereCriteria.js URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/WhereCriteria.js?rev=1736622&view=auto ============================================================================== --- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/WhereCriteria.js (added) +++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/WhereCriteria.js Fri Mar 25 17:55:39 2016 @@ -0,0 +1,242 @@ +/* + * + * 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. + * + */ + +define([ + "dojo/_base/declare", + "dojo/_base/array", + "dojo/_base/lang", + "dojo/string", + "dojo/text!query/WhereCriteria.html", + "dojox/html/entities", + "dijit/popup", + "qpid/management/query/CriteriaPane", + "qpid/common/FormWidgetMixin", + "dijit/_Widget", + "dijit/_TemplatedMixin", + "dijit/_WidgetsInTemplateMixin", + "dijit/layout/ContentPane", + "dijit/form/Button", + "dijit/form/ValidationTextBox", + "dijit/form/TextBox", + "dijit/form/Select", + "dijit/form/Form", + "dijit/_Container", + "dijit/form/SimpleTextarea", + "dijit/InlineEditBox", + "dojo/domReady!" +], +function(declare, array, lang, string, template, entities, popup, CriteriaPane) +{ + return declare("qpid.management.query.WhereCriteria", + [dijit._Widget, dijit._TemplatedMixin, dijit._WidgetsInTemplateMixin, qpid.common.FormWidgetMixin], + { + //Strip out the apache comment header from the template html as comments unsupported. + templateString: template.replace(/<!--[\s\S]*?-->/g, ""), + constructor: function(args) + { + this._attributeDetails = args.attributeDetails; + this.onChange = args.onChange; + this.inherited(arguments); + }, + postCreate: function() + { + this.inherited(arguments); + this._postCreate(); + }, + _postCreate: function() + { + this.removeCriteria.on("click", lang.hitch(this, this._destroy)); + this.doneButton.on("click", lang.hitch(this, this._criteriaSet)); + this.cancelButton.on("click", lang.hitch(this, this._dialogCancelled)); + this.addButton.on("click", lang.hitch(this, this._addCriteria)); + this.expressionMatchCondition.on("change", lang.hitch(this, this._criteriaConditionChanged)); + var criteriaPane = this._addCriteria({_stored:true}); + criteriaPane.submitted(); + this._displayExpression(); + this._criteriaConditionChanged(); + this.editDialog.on("hide", lang.hitch(this, this._dialogHidden)); + }, + _addCriteria:function() + { + var criteriaPane = new CriteriaPane({criteriaName: this._attributeDetails.attributeName, + typeName: this._attributeDetails.type, + typeValidValues: this._attributeDetails.validValues}); + this.criteriaContainer.addChild(criteriaPane); + criteriaPane.on("change", lang.hitch(this, this._criteriaConditionChanged)); + this._updateRemovable(); + this.conditionDialogContent.connectChildren(); + return criteriaPane; + }, + _getNumberOfCriteria : function() + { + var counter = 0; + var criteriaArray = this.criteriaContainer.getChildren(); + for(var i = 0;i<criteriaArray.length;i++) + { + if (!criteriaArray[i]._removed) + { + counter = counter + 1; + } + } + return counter; + }, + _updateRemovable: function() + { + var counter = this._getNumberOfCriteria(); + var singleCriteria = counter == 1; + var criteriaArray = this.criteriaContainer.getChildren(); + for(var i = 0;i<criteriaArray.length;i++) + { + if (!criteriaArray[i]._removed) + { + criteriaArray[i].setRemovable(!singleCriteria); + } + } + this.expressionMatchCondition.set("disabled", singleCriteria); + }, + _getUserFriendlyExpression: function() + { + var expression = this.getConditionExpression(); + if (!expression) + { + expression = this._attributeDetails.attributeName + ": any"; + } + return expression; + }, + _displayExpression: function() + { + var expression = this._getUserFriendlyExpression(); + this.criteria.set("label", expression); + }, + _criteriaConditionChanged: function() + { + this.conditionDialogContent.connectChildren(); + var isValid = this._validateCriteria(); + if (isValid) + { + var expression = this._getUserFriendlyExpression(); + this.newColumnCondition.set("value", expression); + this._updateRemovable(); + } + this.doneButton.set("disabled", !isValid); + }, + _validateCriteria:function() + { + var isValid = true; + var criteriaArray = this.criteriaContainer.getChildren(); + for(var i = 0;i<criteriaArray.length;i++) + { + if (!criteriaArray[i].validate()) + { + isValid = false; + } + } + return isValid; + }, + getAttributeDetails: function() + { + return this._attributeDetails; + }, + getConditionExpression:function() + { + var expression = ""; + var criteriaArray = this.criteriaContainer.getChildren(); + var criteriaCounter = 0; + for(var i = 0;i<criteriaArray.length;i++) + { + var criteria = criteriaArray[i].getExpression(); + if (criteria) + { + if (expression) + { + expression = expression + " " + this.expressionMatchCondition.value; + } + expression = expression + " " + criteria; + criteriaCounter = criteriaCounter + 1; + } + } + if (criteriaCounter>0 && this.expressionMatchCondition.value == "or") + { + expression = "( " + expression + " )" + } + return expression; + }, + _destroy: function() + { + var onChange = this.onChange; + var parentContainer = dijit.getEnclosingWidget(this); + if (parentContainer!= null && parentContainer instanceof dijit._Container) + { + parentContainer.removeChild(this); + + } + + // notify listeners which are listening for onChange events + this.set("value", undefined); + + this.destroyRecursive(false); + + if (onChange) + { + onChange(); + } + }, + _criteriaSet: function() + { + var isValid = this._validateCriteria(); + if (isValid) + { + this._displayExpression(); + var criteriaArray = this.criteriaContainer.getChildren(); + for(var i = 0;i<criteriaArray.length;i++) + { + criteriaArray[i].submitted(); + } + popup.close(this.editDialog); + + // notify listeners which are listening for onChange events + this.set("value", this.getConditionExpression()); + var onChange = this.onChange; + if (onChange) + { + onChange(); + } + } + }, + _dialogCancelled: function() + { + popup.close(this.editDialog); + this._dialogHidden(); + }, + _dialogHidden: function() + { + var criteriaArray = this.criteriaContainer.getChildren(); + for(var i = 0;i<criteriaArray.length;i++) + { + if (criteriaArray[i].cancelled) + { + criteriaArray[i].cancelled(); + } + } + this._updateRemovable(); + } + }); +}); \ No newline at end of file Added: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/ColumnsSelector.html URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/ColumnsSelector.html?rev=1736622&view=auto ============================================================================== --- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/ColumnsSelector.html (added) +++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/ColumnsSelector.html Fri Mar 25 17:55:39 2016 @@ -0,0 +1,46 @@ +<!-- + ~ 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. + --> + +<div id="${id}_columnSelector_Content" data-dojo-type="dijit/layout/ContentPane"> + <div class="dijitDialogPaneContentArea"> + <input id="${id}_ColumnSelector_search" + data-dojo-attach-point="search" type="text" + data-dojo-type="dijit/form/ValidationTextBox" + data-dojo-props="name: 'column', + intermediateChanges: true, + placeHolder: 'field name', + title: 'Start typing field name'" /></label> + <div id="${id}_columnSelector_clearButton" + data-dojo-type="dijit/form/Button" + data-dojo-attach-point="clearButton" + data-dojo-props="iconClass:'dijitIconDelete', showLabel:false, title: 'Clear Search'">Clear</div> + <div data-dojo-attach-point="columnSelectorContainer" class="compactGrid"></div> + </div> + <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar"> + <input id="${id}_columnSelector_cancelButton" + data-dojo-attach-point="cancelButton" + data-dojo-type="dijit/form/Button" + type="button" + label="Cancel"/> + <input id="${id}_columnSelector_doneButton" + data-dojo-attach-point="doneButton" + data-dojo-type="dijit/form/Button" + type="button" label="Done"/> + </div> +</div> \ No newline at end of file Added: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/CriteriaPane.html URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/CriteriaPane.html?rev=1736622&view=auto ============================================================================== --- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/CriteriaPane.html (added) +++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/CriteriaPane.html Fri Mar 25 17:55:39 2016 @@ -0,0 +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. + --> +<div class="criteriaControl"> + <div data-dojo-attach-point="contentPane" class="dijitTitlePane"> + <div data-dojo-attach-point="titleNode" class="dijitReset dijitTitlePaneTitle dijitTitlePaneTitleOpen criteriaPanelTitle"> + <div> + <div data-dojo-attach-point="conditionExpression" class="dijitInline alignLeft dijitTitlePaneTextNode criteriaPanelTitleText"></div> + <span data-dojo-attach-point="removeCriteria" + data-dojo-type="dijit/form/Button" + data-dojo-props="iconClass:'dijitIconDelete', + showLabel:false, + title: 'Remove'" class="dijitInline alignRight criteriaPanelTitleButton">Remove</span> + </div> + <div class="clear"></div> + </div> + <div class="dijitTitlePaneContentOuter dijitTitlePaneContentInner"> + <select data-dojo-attach-point="criteriaCondition" + data-dojo-type="dijit/form/Select" + data-dojo-props="value: 'any', + placeHolder: 'Select Condition', + required: true" class="dijitInline"> + </select> + <span data-dojo-attach-point="criteriaValueInputContainer" class="dijitInline"></span> + </div> + </div> +</div> Added: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/QueryBuilder.html URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/QueryBuilder.html?rev=1736622&view=auto ============================================================================== --- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/QueryBuilder.html (added) +++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/QueryBuilder.html Fri Mar 25 17:55:39 2016 @@ -0,0 +1,72 @@ +<!-- + ~ 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. + --> + +<div> + <div class="dijit dijitToolbar"> + <label>Scope : <span data-dojo-attach-point="scope"></span></label> + <label>Category : <span data-dojo-attach-point="categoryName"></span></label> + <span data-dojo-attach-point="advancedSearch" style="display:none;"> + <label>Select : <input data-dojo-attach-point="selectCriteria" type="text" + data-dojo-type="dijit/form/ValidationTextBox" + data-dojo-props="name: 'select', + intermediateChanges: true, + placeHolder: 'comma separated attribute names', + title: 'Enter comma separated list of attributes to select', + promptMessage: 'Comma separated list of attributes to select, for example: name,type,description', + class: 'querySearchField'" /></label> + <label>Where : <input data-dojo-attach-point="whereCriteria" type="text" + data-dojo-type="dijit/form/ValidationTextBox" + data-dojo-props="name: 'where', + intermediateChanges: true, + placeHolder: 'where expression', + title: 'Enter sql like where conditions', + promptMessage: 'Use JMS filter syntax to specify where conditions', + class: 'querySearchField'" /></label> + </span> + <span data-dojo-attach-point="standardSearchTools"> + <div data-dojo-type="dijit/form/DropDownButton" data-dojo-attach-point="columnsButton" + data-dojo-props="title: 'Select fields to display'"> + <span>Fields</span> + <div data-dojo-type="dijit/TooltipDialog" data-dojo-attach-point="columnsDialog"> + </div> + </div> + <div data-dojo-type="dijit/form/DropDownButton" data-dojo-attach-point="conditionsButton" + data-dojo-props="title: 'Specify Filtering Conditions'"> + <span>Conditions</span> + <div data-dojo-type="dijit/TooltipDialog" data-dojo-attach-point="conditionsDialog"> + </div> + </div> + </span> + <div data-dojo-type="dijit/form/Button" data-dojo-attach-point="searchButton" + data-dojo-props="title: 'Search'">Search</div> + <div data-dojo-type="dijit/form/Button" data-dojo-attach-point="modeButton" + data-dojo-props="title:'Switch to \'Advanced\' search using SQL-like expressions'">Advanced</div> + + <div data-dojo-attach-point="standardModeConditionsToolbar" data-dojo-type="dijit/layout/ContentPane"></div> + </div> + + <div data-dojo-attach-point="queryResultGrid" jsid='grid'></div> + + <div data-dojo-attach-point="testGrid" jsid='grid'></div> + <div class="dijitHidden"> + <div data-dojo-attach-point="selectPanel"></div> + <div data-dojo-attach-point="wherePanel"></div> + <div data-dojo-attach-point="whereCriteria"></div> + </div> +</div> \ No newline at end of file Added: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/WhereCriteria.html URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/WhereCriteria.html?rev=1736622&view=auto ============================================================================== --- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/WhereCriteria.html (added) +++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/WhereCriteria.html Fri Mar 25 17:55:39 2016 @@ -0,0 +1,74 @@ +<!-- + ~ 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. + --> + +<div class="dijit dijitReset dijitInline dijitButtonNode"> + <div id="${id}_whereCriteria_editCriteria" + data-dojo-attach-point="criteria" + data-dojo-type="dijit/form/DropDownButton" + data-dojo-props="showLabel:true, title: 'Set where criteria'"> + <span>Edit</span> + <div data-dojo-type="dijit/TooltipDialog" data-dojo-attach-point="editDialog"> + <div data-dojo-attach-point="conditionDialogContent" + data-dojo-type="dijit/form/Form"> + <script type="dojo/method" data-dojo-event="onSubmit"> + return false; + </script> + + <input class="criteriaControl" + data-dojo-type="dijit/form/TextBox" + data-dojo-attach-point="newColumnCondition" + data-dojo-props="readOnly:true, title: 'Current where expression'"/> + <div class="criteriaControl">Match: <select data-dojo-attach-point="expressionMatchCondition" + data-dojo-type="dijit/form/Select" + data-dojo-props="value: 'and', + required: true, title:'Select how to group multiple conditions'"> + <option value="and">All</option> + <option value="or">Any</option> + </select> + </div> + + <div data-dojo-attach-point="criteriaContainer" + data-dojo-type="dijit/layout/ContentPane" class="criteriaPanelTitle"></div> + <div class="dijitDialogPaneActionBar"> + <div id="${id}_whereCriteria_addButton" + data-dojo-type="dijit/form/Button" + data-dojo-attach-point="addButton" + type="button" label="Add" class="alignLeft"></div> + <div class="alignRight"> + <div id="${id}_whereCriteria_cancelButton" + data-dojo-type="dijit/form/Button" + data-dojo-attach-point="cancelButton" + type="button" label="Cancel"></div> + + <div id="${id}_whereCriteria_doneButton" + data-dojo-type="dijit/form/Button" + data-dojo-attach-point="doneButton" + type="submit" label="Done"></div> + </div> + <div class="clear"></div> + </div> + </div> + </div> + </div> + <div data-dojo-attach-point="removeCriteria" + data-dojo-type="dijit/form/Button" + data-dojo-props="iconClass:'dijitIconDelete', + showLabel:false, + title: 'Remove'">Remove</div> +</div> Added: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/showQueryTab.html URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/showQueryTab.html?rev=1736622&view=auto ============================================================================== --- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/showQueryTab.html (added) +++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/showQueryTab.html Fri Mar 25 17:55:39 2016 @@ -0,0 +1,24 @@ +<!-- + - + - 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. + - + --> +<div class="query"> + <div class="queryEditorNode"></div> +</div> + Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/showVirtualHost.html URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/showVirtualHost.html?rev=1736622&r1=1736621&r2=1736622&view=diff ============================================================================== --- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/showVirtualHost.html (original) +++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/showVirtualHost.html Fri Mar 25 17:55:39 2016 @@ -115,11 +115,15 @@ </div> <div class="dijitDialogPaneActionBar"> - <button data-dojo-type="dijit.form.Button" class="startButton" type="button" data-dojo-props="disabled: true">Start</button> - <button data-dojo-type="dijit.form.Button" class="stopButton" type="button" data-dojo-props="disabled: true">Stop</button> - <button data-dojo-type="dijit.form.Button" class="editButton" type="button" data-dojo-props="disabled: true">Edit</button> - <button data-dojo-type="dijit.form.Button" class="downloadButton" type="button" data-dojo-props="disabled: true">Download</button> - <button data-dojo-type="dijit.form.Button" class="deleteButton" data-dojo-props="iconClass: 'dijitIconDelete'">Delete</button> + <button data-dojo-type="dijit.form.Button" class="addQuery alignLeft">Query</button> + <div class="alignRight"> + <button data-dojo-type="dijit.form.Button" class="startButton" type="button" data-dojo-props="disabled: true">Start</button> + <button data-dojo-type="dijit.form.Button" class="stopButton" type="button" data-dojo-props="disabled: true">Stop</button> + <button data-dojo-type="dijit.form.Button" class="editButton" type="button" data-dojo-props="disabled: true">Edit</button> + <button data-dojo-type="dijit.form.Button" class="downloadButton" type="button" data-dojo-props="disabled: true">Download</button> + <button data-dojo-type="dijit.form.Button" class="deleteButton" data-dojo-props="iconClass: 'dijitIconDelete'">Delete</button> + </div> + <div class="clear"></div> </div> <br/> Modified: qpid/java/trunk/broker-plugins/management-http/src/main/resources-maven/dojoconfig.properties URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/resources-maven/dojoconfig.properties?rev=1736622&r1=1736621&r2=1736622&view=diff ============================================================================== --- qpid/java/trunk/broker-plugins/management-http/src/main/resources-maven/dojoconfig.properties (original) +++ qpid/java/trunk/broker-plugins/management-http/src/main/resources-maven/dojoconfig.properties Fri Mar 25 17:55:39 2016 @@ -22,4 +22,6 @@ dojo-version=${dojo-version} dojo-path=/dojo-${dojo-version}/dojo dijit-path=/dojo-${dojo-version}/dijit dojox-path=/dojo-${dojo-version}/dojox +dgrid-path=/META-INF/resources/webjars/dgrid/${dgrid-version} +dstore-path=/META-INF/resources/webjars/dstore/${dstore-version} Modified: qpid/java/trunk/client/example/src/main/java/org/apache/qpid/example/Hello.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/client/example/src/main/java/org/apache/qpid/example/Hello.java?rev=1736622&r1=1736621&r2=1736622&view=diff ============================================================================== --- qpid/java/trunk/client/example/src/main/java/org/apache/qpid/example/Hello.java (original) +++ qpid/java/trunk/client/example/src/main/java/org/apache/qpid/example/Hello.java Fri Mar 25 17:55:39 2016 @@ -23,6 +23,7 @@ package org.apache.qpid.example; import java.io.InputStream; import java.util.Properties; +import java.util.Random; import javax.jms.Connection; import javax.jms.ConnectionFactory; @@ -34,6 +35,9 @@ import javax.jms.TextMessage; import javax.naming.Context; import javax.naming.InitialContext; +import org.apache.qpid.client.AMQDestination; +import org.apache.qpid.configuration.ClientProperties; + public class Hello { @@ -44,16 +48,24 @@ public class Hello public static void main(String[] args) { + System.setProperty(ClientProperties.DEST_SYNTAX, AMQDestination.DestSyntax.BURL.name()); + System.setProperty(ClientProperties.AMQP_VERSION, "0-9"); Hello hello = new Hello(); - hello.runTest(); + for(int i =0; i<100;i++) + { + + hello.runTest("test-" + i); + } } - private void runTest() + private void runTest(String queueName) { try (InputStream resourceAsStream = this.getClass().getResourceAsStream("hello.properties")) { Properties properties = new Properties(); - properties.load(resourceAsStream); + //properties.load(resourceAsStream); + properties.put("java.naming.factory.initial", "org.apache.qpid.jndi.PropertiesFileInitialContextFactory"); + properties.put("connectionfactory.qpidConnectionfactory", "amqp://guest:guest@clientid/?brokerlist='tcp://localhost:5672'"); Context context = new InitialContext(properties); ConnectionFactory connectionFactory = (ConnectionFactory) context.lookup("qpidConnectionfactory"); @@ -61,16 +73,20 @@ public class Hello connection.start(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - Destination destination = (Destination) context.lookup("topicExchange"); + Destination destination = session.createQueue(queueName); MessageProducer messageProducer = session.createProducer(destination); MessageConsumer messageConsumer = session.createConsumer(destination); - TextMessage message = session.createTextMessage("Hello world!"); - messageProducer.send(message); + Random rn = new Random(); + for (int i=0;i< rn.nextInt(10);i++) + { + TextMessage message = session.createTextMessage("Hello world! from " + queueName); + messageProducer.send(message); + } - message = (TextMessage)messageConsumer.receive(); - System.out.println(message.getText()); + //message = (TextMessage)messageConsumer.receive(); + // System.out.println(message.getText()); connection.close(); context.close(); Modified: qpid/java/trunk/systests/pom.xml URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/pom.xml?rev=1736622&r1=1736621&r2=1736622&view=diff ============================================================================== --- qpid/java/trunk/systests/pom.xml (original) +++ qpid/java/trunk/systests/pom.xml Fri Mar 25 17:55:39 2016 @@ -173,6 +173,11 @@ <optional>true</optional> </dependency> + <dependency> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-servlet_3.0_spec</artifactId> + <version>${geronimo-servlet-version}</version> + </dependency> </dependencies> <build> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
