qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oru...@apache.org
Subject svn commit: r1677590 [5/6] - in /qpid/java/trunk: bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb_ha/ bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/ broker-plugins/jdbc-store/src/main/java/resources/js/q...
Date Mon, 04 May 2015 12:17:25 GMT
Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addStore.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addStore.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addStore.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addStore.js Mon May  4 12:17:23 2015
@@ -28,7 +28,6 @@ define(["dojo/_base/lang",
         "dojo/_base/event",
         'dojo/json',
         "qpid/common/util",
-        "qpid/common/metadata",
         "dojo/text!addStore.html",
         "dojo/store/Memory",
         "dojox/validate/us",
@@ -44,7 +43,7 @@ define(["dojo/_base/lang",
         "dijit/layout/ContentPane",
         "dojox/layout/TableContainer",
         "dojo/domReady!"],
-    function (lang, dom, construct, registry, parser, memory, array, event, json, util, metadata, template)
+    function (lang, dom, construct, registry, parser, memory, array, event, json, util, template)
     {
         var addStore =
         {
@@ -72,8 +71,11 @@ define(["dojo/_base/lang",
                 this.storeType = registry.byId("addStore.type");
                 this.storeType.on("change", function(type){that._storeTypeChanged(type);});
             },
-            setupTypeStore: function(category)
+            setupTypeStore: function(management, category, modelObj)
             {
+                this.management = management;
+                this.modelObj = modelObj;
+                var metadata = management.metadata;
                 this.category = category;
                 var storeTypeSupportedTypes = metadata.getTypesForCategory(category);
                 storeTypeSupportedTypes.sort();
@@ -98,6 +100,7 @@ define(["dojo/_base/lang",
             _initFields:function(data)
             {
                 var type = data["type"];
+                var metadata = this.management.metadata;
                 var attributes = metadata.getMetaData(this.category, type).attributes;
                 for(var name in attributes)
                 {
@@ -130,14 +133,16 @@ define(["dojo/_base/lang",
 
                     var storeData = util.getFormWidgetValues(this.storeForm, this.initialData);
                     var that = this;
-                    var url = "api/latest/" + encodeURIComponent(this.category.toLowerCase());
 
                     if (this.effectiveData)
                     {
                         // update request
-                        url += "/" + encodeURIComponent(this.storeName.value);
+                        this.management.update(this.modelObj, storeData, function(x){that.dialog.hide();});
+                    }
+                    else
+                    {
+                        this.management.create(this.category, this.modelObj, storeData, function(x){that.dialog.hide();});
                     }
-                    util.post(url, storeData, function(x){that.dialog.hide();});
                 }
                 else
                 {
@@ -165,8 +170,9 @@ define(["dojo/_base/lang",
                      {
                          try
                          {
-                             typeUI.show({containerNode:typeFieldsContainer, parent: that, data: that.initialData, effectiveData: that.effectiveData});
-                             util.applyMetadataToWidgets(typeFieldsContainer, category, type);
+                             var metadata = that.management.metadata;
+                             typeUI.show({containerNode:typeFieldsContainer, parent: that, data: that.initialData, effectiveData: that.effectiveData, metadata: metadata});
+                             util.applyMetadataToWidgets(typeFieldsContainer, category, type, metadata);
                          }
                          catch(e)
                          {

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js Mon May  4 12:17:23 2015
@@ -36,7 +36,6 @@ define([
         "dijit/form/FilteringSelect",
         "qpid/common/properties",
         "qpid/common/util",
-        "qpid/common/metadata",
         "dojo/text!addVirtualHostNodeAndVirtualHost.html",
         "qpid/common/ContextVariablesEditor",
         "dijit/TitlePane",
@@ -48,7 +47,7 @@ define([
         "dojox/validate/us",
         "dojox/validate/web",
         "dojo/domReady!"],
-  function (event, lang, array, dom, domConstruct, json, parser, Memory, win, on, fobject, registry, Dialog, Button, FilteringSelect, properties, util, metadata, template)
+  function (event, lang, array, dom, domConstruct, json, parser, Memory, win, on, fobject, registry, Dialog, Button, FilteringSelect, properties, util, template)
   {
 
     var addVirtualHostNodeAndVirtualHost =
@@ -93,11 +92,6 @@ define([
 
         this.virtualHostType.set("disabled", true);
 
-        var supportedVirtualHostNodeTypes = metadata.getTypesForCategory("VirtualHostNode");
-        supportedVirtualHostNodeTypes.sort();
-
-        var virtualHostNodeTypeStore = util.makeTypeStore(supportedVirtualHostNodeTypes);
-        this.virtualHostNodeType.set("store", virtualHostNodeTypeStore);
         this.virtualHostNodeType.set("disabled", false);
         this.virtualHostNodeType.on("change", function(type){that._vhnTypeChanged(type, that.virtualHostNodeTypeFieldsContainer, "qpid/management/virtualhostnode/");});
 
@@ -121,13 +115,21 @@ define([
 
         this.virtualHostNodeUploadFields.style.display = "none";
       },
-      show: function()
+      show: function(management)
       {
+        this.management = management;
         this.virtualHostNodeForm.reset();
         this.virtualHostNodeType.set("value", null);
 
         this.virtualHostForm.reset();
         this.virtualHostType.set("value", null);
+
+        var supportedVirtualHostNodeTypes = management.metadata.getTypesForCategory("VirtualHostNode");
+        supportedVirtualHostNodeTypes.sort();
+
+        var virtualHostNodeTypeStore = util.makeTypeStore(supportedVirtualHostNodeTypes);
+        this.virtualHostNodeType.set("store", virtualHostNodeTypeStore);
+
         if (!this.virtualHostNodeContext)
         {
                 this.virtualHostNodeContext = new qpid.common.ContextVariablesEditor({name: 'context', title: 'Context variables'});
@@ -159,8 +161,17 @@ define([
 
         }
 
-        this.virtualHostNodeContext.loadInheritedData("api/latest/broker");
-        this.virtualHostContext.setData({}, this.virtualHostNodeContext.effectiveValues,this.virtualHostNodeContext.inheritedActualValues);
+        var that = this;
+        management.load({ type: "broker"}).then(
+             function(effectiveData)
+             {
+                util.setContextData(that.virtualHostNodeContext, management, {type: "broker"}, {}, effectiveData[0],
+                     function()
+                     {
+                        that.virtualHostContext.setData({}, that.virtualHostNodeContext.effectiveValues,that.virtualHostNodeContext.inheritedActualValues);
+                     });
+             },
+             util.xhrErrorHandler);
 
         this.dialog.show();
         if (!this.resizeEventRegistered)
@@ -185,7 +196,7 @@ define([
       },
       _vhnTypeChanged: function (type, typeFieldsContainer, urlStem)
       {
-        var validChildTypes = metadata.validChildTypes("VirtualHostNode", type, "VirtualHost");
+        var validChildTypes = this.management ? this.management.metadata.validChildTypes("VirtualHostNode", type, "VirtualHost") : [];
         validChildTypes.sort();
 
         var virtualHostTypeStore = util.makeTypeStore( validChildTypes );
@@ -236,9 +247,9 @@ define([
               {
                   try
                   {
-                      typeUI.show({containerNode:typeFieldsContainer, parent: that});
-
-                      util.applyMetadataToWidgets(typeFieldsContainer,category, type);
+                      var metadata = that.management.metadata;
+                      typeUI.show({containerNode:typeFieldsContainer, parent: that, metadata:metadata});
+                      util.applyMetadataToWidgets(typeFieldsContainer,category, type, metadata);
                   }
                   catch(e)
                   {
@@ -340,7 +351,7 @@ define([
         }
 
         var that = this;
-        util.post("api/latest/virtualhostnode", virtualHostNodeData, function(x){that.dialog.hide();});
+        that.management.create("virtualhostnode", {type: "broker"}, virtualHostNodeData, function(x){that.dialog.hide();});
       },
       _getValues: function (form)
       {

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/PrincipalDatabaseAuthenticationManager.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/PrincipalDatabaseAuthenticationManager.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/PrincipalDatabaseAuthenticationManager.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/PrincipalDatabaseAuthenticationManager.js Mon May  4 12:17:23 2015
@@ -18,8 +18,7 @@
  * under the License.
  *
  */
-define(["dojo/_base/xhr",
-        "dojo/dom",
+define(["dojo/dom",
         "dojo/parser",
         "dojo/query",
         "dojo/dom-construct",
@@ -32,6 +31,9 @@ define(["dojo/_base/xhr",
         "qpid/common/properties",
         "qpid/common/UpdatableStore",
         "dojox/grid/EnhancedGrid",
+        "dojo/text!authenticationprovider/showPrincipalDatabaseAuthenticationManager.html",
+        "dojo/text!authenticationprovider/addUser.html",
+        "dojo/text!authenticationprovider/setPassword.html",
         "dojox/grid/enhanced/plugins/Pagination",
         "dojox/grid/enhanced/plugins/IndirectSelection",
         "dojox/validate/us", "dojox/validate/web",
@@ -42,20 +44,18 @@ define(["dojo/_base/xhr",
         "dijit/form/Form",
         "dijit/form/DateTextBox",
         "dojo/domReady!"],
-    function (xhr, dom, parser, query, construct, connect, win, event, json, registry, util, properties, UpdatableStore, EnhancedGrid) {
+    function (dom, parser, query, construct, connect, win, event, json, registry, util, properties, UpdatableStore, EnhancedGrid, template, addUserTemplate, setPasswordTemplate) {
         function DatabaseAuthManager(containerNode, authProviderObj, controller) {
             var node = construct.create("div", null, containerNode, "last");
             var that = this;
             this.name = authProviderObj.name;
-            xhr.get({url: "authenticationprovider/showPrincipalDatabaseAuthenticationManager.html",
-                                    sync: true,
-                                    load:  function(data) {
-                                        node.innerHTML = data;
-                                        parser.parse(node).then(function(instances)
-                                        {
-                                            that.init(node, authProviderObj, controller);
-                                        });
-                                    }});
+            this.modelObj = authProviderObj;
+            this.management = controller.management;
+            node.innerHTML = template;
+            parser.parse(node).then(function(instances)
+            {
+                that.init(node, authProviderObj, controller);
+            });
         }
 
         DatabaseAuthManager.prototype.update = function() {
@@ -71,7 +71,7 @@ define(["dojo/_base/xhr",
             this.controller = controller;
             var that = this;
 
-                     that.authProviderData = authProviderObj;
+                     that.authProviderData = {};
 
                      var userDiv = query(".users")[0];
 
@@ -103,13 +103,13 @@ define(["dojo/_base/xhr",
                                                     theItem = this.getItem(idx);
                                                     var name = obj.dataStore.getValue(theItem,"name");
                                                     var id = obj.dataStore.getValue(theItem,"id");
-                                                    setPassword.show(that.name, {name: name, id: id});
+                                                    setPassword.show(that.management, that.modelObj, {name: name, id: id});
                                                 });
                                         }, gridProperties, EnhancedGrid);
 
 
                      var addUserButton = query(".addUserButton", node)[0];
-                     connect.connect(registry.byNode(addUserButton), "onClick", function(evt){ addUser.show(that.name) });
+                     connect.connect(registry.byNode(addUserButton), "onClick", function(evt){ addUser.show(that.management, that.modelObj) });
 
                      var deleteUserButton = query(".deleteUserButton", node)[0];
                      var deleteWidget = registry.byNode(deleteUserButton);
@@ -127,29 +127,19 @@ define(["dojo/_base/xhr",
             if(data.length) {
                 var that = this;
                 if(confirm("Delete " + data.length + " users?")) {
-                    var i, queryParam;
+                    var i;
+                    var parameters ={id:[]};
                     for(i = 0; i<data.length; i++) {
-                        if(queryParam) {
-                            queryParam += "&";
-                        } else {
-                            queryParam = "?";
-                        }
-
-                        queryParam += "id=" + data[i].id;
+                        parameters.id.push(data[i].id);
                     }
-                    var query = "api/latest/user/"+ encodeURIComponent(that.name)
-                       + queryParam;
+
                     that.success = true
-                    xhr.del({url: query, sync: true, handleAs: "json"}).then(
+                    this.management.remove({type: "user", parent: this.modelObj}, parameters).then(
                         function(data) {
                             grid.setQuery({id: "*"});
                             grid.selection.deselectAll();
-                            that.update();
                         },
-                        function(error) {that.success = false; that.failureReason = error;});
-                    if(!that.success ) {
-                        util.xhrErrorHandler(this.failureReason);
-                    }
+                        util.xhrErrorHandler);
                 }
 }
         };
@@ -181,16 +171,12 @@ define(["dojo/_base/xhr",
             };
 
 
-        xhr.get({url: "authenticationprovider/addUser.html",
-                 sync: true,
-                 load:  function(data) {
+        node.innerHTML = addUserTemplate;
+        addUser.dialogNode = dom.byId("addUser");
+        parser.parse(node).then(
+                function(instances)
+                {
                             var theForm;
-                            node.innerHTML = data;
-                            addUser.dialogNode = dom.byId("addUser");
-                            parser.instantiate([addUser.dialogNode]);
-
-                            var that = this;
-
                             theForm = registry.byId("formAddUser");
                             theForm.on("submit", function(e) {
 
@@ -199,9 +185,7 @@ define(["dojo/_base/xhr",
 
                                     var newUser = convertToUser(theForm.getValues());
 
-
-                                    var url = "api/latest/user/"+encodeURIComponent(addUser.authProvider);
-                                    util.post(url, newUser, function(x){registry.byId("addUser").hide();});
+                                    addUser.management.create("user", addUser.authProvider, newUser, function(x){registry.byId("addUser").hide();}, util.xhrErrorHandler);
                                     return false;
 
 
@@ -211,9 +195,10 @@ define(["dojo/_base/xhr",
                                 }
 
                             });
-                        }});
+                });
 
-        addUser.show = function(authProvider) {
+        addUser.show = function(management, authProvider) {
+            addUser.management=management;
             addUser.authProvider = authProvider;
             registry.byId("formAddUser").reset();
             registry.byId("addUser").show();
@@ -224,17 +209,12 @@ define(["dojo/_base/xhr",
 
         var setPasswordNode = construct.create("div", null, win.body(), "last");
 
-        xhr.get({url: "authenticationprovider/setPassword.html",
-                 sync: true,
-                 load:  function(data) {
-                    var theForm;
-                    setPasswordNode.innerHTML = data;
-                    setPassword.dialogNode = dom.byId("setPassword");
-                    parser.instantiate([setPassword.dialogNode]);
-
-                    var that = this;
-
-                    theForm = registry.byId("formSetPassword");
+        setPasswordNode.innerHTML = setPasswordTemplate;
+        setPassword.dialogNode = dom.byId("setPassword");
+        parser.parse(setPasswordNode).then(
+                function(instances)
+                {
+                    var theForm = registry.byId("formSetPassword");
                     theForm.on("submit", function(e) {
 
                         event.stop(e);
@@ -244,10 +224,9 @@ define(["dojo/_base/xhr",
                             newUser.name = setPassword.name;
                             newUser.id = setPassword.id;
 
-                            var url = "api/latest/user/"+encodeURIComponent(setPassword.authProvider) +
-                                "/"+encodeURIComponent(newUser.name);
-
-                            util.post(url, newUser, function(x){registry.byId("setPassword").hide();});
+                            var model = {type: "user", name: setPassword.name, parent: setPassword.authProvider};
+                            setPassword.management.update(model, newUser,
+                                function(x){registry.byId("setPassword").hide();}, util.xhrErrorHandler);
                             return false;
 
 
@@ -257,9 +236,10 @@ define(["dojo/_base/xhr",
                         }
 
                     });
-                }});
+                });
 
-        setPassword.show = function(authProvider, user) {
+        setPassword.show = function(management, authProvider, user) {
+            setPassword.management = management;
             setPassword.authProvider = authProvider;
             setPassword.name = user.name;
             setPassword.id = user.id;

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/base64md5passwordfile/show.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/base64md5passwordfile/show.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/base64md5passwordfile/show.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/base64md5passwordfile/show.js Mon May  4 12:17:23 2015
@@ -19,7 +19,7 @@
  *
  */
 define(["qpid/common/util", "dojo/domReady!"],
-  function (util, metadata)
+  function (util)
   {
 
     function Base64MD5PasswordFile(data)

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/external/add.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/external/add.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/external/add.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/external/add.js Mon May  4 12:17:23 2015
@@ -31,6 +31,7 @@ define(["dojo/query","dijit/registry","q
                     {
                         var useFullDN = registry.byNode(query(".useFullDN", data.containerNode)[0]);
                         useFullDN.set("value", data.data.useFullDN);
+                        useFullDN.set("checked", data.data.useFullDN);
                     }
                 });
             }

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/external/show.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/external/show.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/external/show.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/external/show.js Mon May  4 12:17:23 2015
@@ -19,7 +19,7 @@
  *
  */
 define(["qpid/common/util", "dojo/domReady!"],
-  function (util, metadata)
+  function (util)
   {
 
     function External(data)

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plainpasswordfile/show.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plainpasswordfile/show.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plainpasswordfile/show.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plainpasswordfile/show.js Mon May  4 12:17:23 2015
@@ -19,7 +19,7 @@
  *
  */
 define(["qpid/common/util", "dojo/domReady!"],
-  function (util, metadata)
+  function (util)
   {
 
     function PlainPasswordFile(data)

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/add.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/add.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/add.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/add.js Mon May  4 12:17:23 2015
@@ -18,8 +18,8 @@
  * under the License.
  *
  */
-define(["dojo/_base/xhr","dojo/query","dijit/registry","qpid/common/util","qpid/common/metadata","dojo/store/Memory","dijit/form/FilteringSelect","dijit/form/ValidationTextBox","dijit/form/CheckBox"],
-    function (xhr, query, registry, util, metadata, Memory)
+define(["dojo/query","dijit/registry","qpid/common/util","dojo/store/Memory","dijit/form/FilteringSelect","dijit/form/ValidationTextBox","dijit/form/CheckBox"],
+    function (query, registry, util, Memory)
     {
         return {
             show: function(data)
@@ -30,17 +30,19 @@ define(["dojo/_base/xhr","dojo/query","d
             _postParse: function(data)
             {
                 var that = this;
-                xhr.get({url: "api/latest/truststore", sync: true, handleAs: "json"}).then(
+                var obj = {type:"truststore", parent: {type: "broker"}};
+                data.parent.management.load(obj).then(
                     function(trustStores)
                     {
                         that._initTrustStores(trustStores, data.containerNode);
-                    }
+                        if (data.data)
+                        {
+                            that._initFields(data.data, data.containerNode, data.parent.management.metadata );
+                        }
+                    },
+                    util.xhrErrorHandler
                 );
 
-                if (data.data)
-                {
-                    this._initFields(data.data, data.containerNode );
-                }
             },
             _initTrustStores: function(trustStores, containerNode)
             {
@@ -54,7 +56,7 @@ define(["dojo/_base/xhr","dojo/query","d
                 var trustStore = registry.byNode(query(".trustStore", containerNode)[0]);
                 trustStore.set("store", trustStoresStore);
             },
-            _initFields:function(data, containerNode)
+            _initFields:function(data, containerNode, metadata)
             {
                 var attributes = metadata.getMetaData("AuthenticationProvider", "SimpleLDAP").attributes;
                 for(var name in attributes)

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/show.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/show.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/show.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/show.js Mon May  4 12:17:23 2015
@@ -17,14 +17,14 @@
  * under the License.
  */
 
-define(["qpid/common/util", "qpid/common/metadata", "dojo/domReady!"],
-  function (util, metadata)
+define(["qpid/common/util", "dojo/domReady!"],
+  function (util)
   {
 
     function SimpleLdapAuthenticationProvider(data)
     {
         this.fields = [];
-        var attributes = metadata.getMetaData("AuthenticationProvider", "SimpleLDAP").attributes;
+        var attributes = data.parenet.management.metadata.getMetaData("AuthenticationProvider", "SimpleLDAP").attributes;
         for(var name in attributes)
         {
             this.fields.push(name);

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js Mon May  4 12:17:23 2015
@@ -22,7 +22,6 @@ define(["dojo/dom",
         "dijit/registry",
         "dijit/layout/ContentPane",
         "dijit/form/CheckBox",
-        "qpid/management/UserPreferences",
         "dojox/html/entities",
         "qpid/management/Broker",
         "qpid/management/VirtualHost",
@@ -42,7 +41,7 @@ define(["dojo/dom",
         "qpid/management/VirtualHostNode",
         "dojo/ready",
         "dojo/domReady!"],
-       function (dom, registry, ContentPane, CheckBox, UserPreferences, entities, Broker, VirtualHost, Exchange, Queue, Connection, AuthProvider,
+       function (dom, registry, ContentPane, CheckBox, entities, Broker, VirtualHost, Exchange, Queue, Connection, AuthProvider,
                  GroupProvider, Group, KeyStore, TrustStore, AccessControlProvider, Port, Plugin, LogViewer, PreferencesProvider, VirtualHostNode, ready) {
            var controller = {};
 
@@ -104,10 +103,11 @@ define(["dojo/dom",
                                                            }
                        });
                        this.tabContainer.addChild( contentPane );
+                       var userPreferences = this.management.userPreferences;
                        if (objType != "broker")
                        {
                          var preferencesCheckBox = new dijit.form.CheckBox({
-                           checked: UserPreferences.isTabStored(obj.tabData),
+                           checked: userPreferences.isTabStored(obj.tabData),
                            title: "If checked the tab is saved in user preferences and restored on next login"
                          });
                          var tabs = this.tabContainer.tablist.getChildren();
@@ -115,11 +115,11 @@ define(["dojo/dom",
                          preferencesCheckBox.on("change", function(value){
                            if (value)
                            {
-                             UserPreferences.appendTab(obj.tabData);
+                             userPreferences.appendTab(obj.tabData);
                            }
                            else
                            {
-                             UserPreferences.removeTab(obj.tabData);
+                             userPreferences.removeTab(obj.tabData);
                            }
                          });
                        }
@@ -135,6 +135,10 @@ define(["dojo/dom",
 
            };
 
+            controller.init=function(management)
+            {
+                controller.management = management;
+            }
 
            return controller;
        });

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editBroker.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editBroker.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editBroker.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editBroker.js Mon May  4 12:17:23 2015
@@ -18,8 +18,7 @@
  * under the License.
  *
  */
-define(["dojo/_base/xhr",
-        "dojox/html/entities",
+define(["dojox/html/entities",
         "dojo/_base/array",
         "dojo/_base/event",
         "dojo/_base/lang",
@@ -44,7 +43,7 @@ define(["dojo/_base/xhr",
         "dojox/validate/us",
         "dojox/validate/web",
         "dojo/domReady!"],
-  function (xhr, entities, array, event, lang, win, dom, domConstruct, registry, parser, json, query, Memory, ObjectStore, util, template)
+  function (entities, array, event, lang, win, dom, domConstruct, registry, parser, json, query, Memory, ObjectStore, util, template)
   {
     var fields = [ "name", "defaultVirtualHost", "statisticsReportingPeriod", "statisticsReportingResetEnabled", "connection.sessionCountLimit", "connection.heartBeatDelay"];
     var numericFieldNames = ["statisticsReportingPeriod", "connection.sessionCountLimit", "connection.heartBeatDelay"];
@@ -73,30 +72,22 @@ define(["dojo/_base/xhr",
         this.form = registry.byId("editBrokerForm");
         this.form.on("submit", function(){return false;});
         this.context = registry.byId("editBroker.context");
-        util.applyMetadataToWidgets(dom.byId("editBroker.allFields"), "Broker", "broker");
 
         for(var i = 0; i < numericFieldNames.length; i++)
         {
             this[numericFieldNames[i]].set("regExpGen", util.numericOrContextVarRegexp);
         }
       },
-      show: function(brokerData)
+      show: function(management, brokerData)
       {
+        this.management = management;
         var that=this;
-        this.query = "api/latest/broker";
         this.dialog.set("title", "Edit Broker - " + entities.encode(String(brokerData.name)));
-        xhr.get(
-            {
-              url: this.query,
-              sync: true,
-              content: { actuals: true },
-              handleAs: "json",
-              load: function(data)
+        management.load( {type:"broker"}, { actuals: true },
+              function(data)
               {
                 that._show(data[0], brokerData);
-              }
-            }
-        );
+              });
       },
       destroy: function()
       {
@@ -129,7 +120,7 @@ define(["dojo/_base/xhr",
               }
 
               var that = this;
-              util.post(this.query, data, function(x){that.dialog.hide()})
+              this.management.update({type: "broker"}, data, function(x){that.dialog.hide();}, util.xhrErrorHandler);
           }
           else
           {
@@ -170,7 +161,8 @@ define(["dojo/_base/xhr",
               widget.set("value", actualData[fieldName]);
             }
           }
-          this.context.load(this.query, {actualValues: actualData.context, effectiveValues: effectiveData.context});
+          util.applyMetadataToWidgets(dom.byId("editBroker.allFields"), "Broker", "broker", this.management.metadata);
+          util.setContextData(this.context, management, {type: "broker"}, actualData, effectiveData );
           this.dialog.startup();
           this.dialog.show();
           if (!this.resizeEventRegistered)

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editQueue.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editQueue.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editQueue.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editQueue.js Mon May  4 12:17:23 2015
@@ -18,8 +18,7 @@
  * under the License.
  *
  */
-define(["dojo/_base/xhr",
-        "dojox/html/entities",
+define(["dojox/html/entities",
         "dojo/_base/array",
         "dojo/_base/event",
         "dojo/_base/lang",
@@ -42,7 +41,7 @@ define(["dojo/_base/xhr",
         "dojox/validate/us",
         "dojox/validate/web",
         "dojo/domReady!"],
-  function (xhr, entities, array, event, lang, win, dom, domConstruct, registry, parser, json, query, util, template)
+  function (entities, array, event, lang, win, dom, domConstruct, registry, parser, json, query, util, template)
   {
     var fields = ["name",
                   "type",
@@ -99,40 +98,28 @@ define(["dojo/_base/xhr",
         this.form.on("submit", function(){return false;});
         this.typeSelector = registry.byId("formEditQueue.type");
       },
-      show: function(hostData)
+      show: function(management,modelObj)
       {
         var that=this;
+        this.management = management;
+        this.modelObj = modelObj;
         if (!this.context)
         {
          this.context = new qpid.common.ContextVariablesEditor({name: 'context', title: 'Context variables'});
          this.context.placeAt(dom.byId("formEditQueue.context"));
         }
-        this.query = "api/latest/queue/" + encodeURIComponent(hostData.nodeName) + "/" + encodeURIComponent(hostData.hostName) + "/" + encodeURIComponent(hostData.queueName);
-        this.dialog.set("title", "Edit Queue - " + entities.encode(String(hostData.queueName)));
-        xhr.get(
-            {
-              url: this.query,
-              sync: true,
-              content: { actuals: true },
-              handleAs: "json",
-              load: function(data)
+        this.dialog.set("title", "Edit Queue - " + entities.encode(String(modelObj.name)));
+        management.load(modelObj, { actuals: true },
+              function(actualData)
               {
-                that._show(data[0], hostData);
-              }
-            }
-        );
-        var queueType = this.typeSelector.get("value");
-        query(".typeSpecificDiv").forEach(function(node, index, arr){
-            if (node.id === "formEditQueueType:" + queueType)
-            {
-                node.style.display = "block";
-                util.applyMetadataToWidgets(node, "Queue", queueType);
-            }
-            else
-            {
-                node.style.display = "none";
-            }
-        });
+                management.load(modelObj).then(
+                               function(effectiveData)
+                               {
+                                 that._show(actualData[0], effectiveData[0]);
+                               },
+                               util.xhrErrorHandler);
+              },
+              util.xhrErrorHandler);
       },
       destroy: function()
       {
@@ -164,7 +151,7 @@ define(["dojo/_base/xhr",
                 data["context"] = context;
               }
               var that = this;
-              util.post(this.query, data, function(x){that.dialog.hide()});
+              this.management.update(that.modelObj, data, function(x){that.dialog.hide()});
           }
           else
           {
@@ -192,9 +179,9 @@ define(["dojo/_base/xhr",
           }
 
           var that = this;
-          util.applyMetadataToWidgets(that.allFieldsContainer, "Queue", actualData.type);
+          util.applyMetadataToWidgets(that.allFieldsContainer, "Queue", actualData.type, this.management.metadata);
 
-          this.context.load(this.query, {actualValues:actualData.context, effectiveValues:effectiveData.context});
+          util.setContextData(this.context, this.management, this.modelObj, actualData, effectiveData);
 
           // Add regexp to the numeric fields
           for(var i = 0; i < numericFieldNames.length; i++)
@@ -202,6 +189,18 @@ define(["dojo/_base/xhr",
             this[numericFieldNames[i]].set("regExpGen", util.numericOrContextVarRegexp);
           }
 
+          var queueType = this.typeSelector.get("value");
+          query(".typeSpecificDiv").forEach(function(node, index, arr){
+              if (node.id === "formEditQueueType:" + queueType)
+              {
+                  node.style.display = "block";
+                  util.applyMetadataToWidgets(node, "Queue", queueType, that.management.metadata);
+              }
+              else
+              {
+                  node.style.display = "none";
+              }
+          });
           this.dialog.startup();
           this.dialog.show();
           if (!this.resizeEventRegistered)

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHost.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHost.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHost.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHost.js Mon May  4 12:17:23 2015
@@ -18,8 +18,7 @@
  * under the License.
  *
  */
-define(["dojo/_base/xhr",
-        "dojox/html/entities",
+define(["dojox/html/entities",
         "dojo/_base/array",
         "dojo/_base/event",
         "dojo/_base/lang",
@@ -44,7 +43,7 @@ define(["dojo/_base/xhr",
         "dojox/validate/us",
         "dojox/validate/web",
         "dojo/domReady!"],
-  function (xhr, entities, array, event, lang, win, dom, domConstruct, registry, parser, json, query, Memory, ObjectStore, util, template)
+  function (entities, array, event, lang, win, dom, domConstruct, registry, parser, json, query, Memory, ObjectStore, util, template)
   {
     var fields = [ "name", "queue.deadLetterQueueEnabled", "storeTransactionIdleTimeoutWarn", "storeTransactionIdleTimeoutClose", "storeTransactionOpenTimeoutWarn", "storeTransactionOpenTimeoutClose", "housekeepingCheckPeriod", "housekeepingThreadCount"];
     var numericFieldNames = ["storeTransactionIdleTimeoutWarn", "storeTransactionIdleTimeoutClose", "storeTransactionOpenTimeoutWarn", "storeTransactionOpenTimeoutClose", "housekeepingCheckPeriod", "housekeepingThreadCount"];
@@ -76,28 +75,30 @@ define(["dojo/_base/xhr",
         this.form = registry.byId("editVirtualHostForm");
         this.form.on("submit", function(){return false;});
       },
-      show: function(hostData)
+      show: function(management, modelObj)
       {
+        this.management = management;
+        this.modelObj = modelObj;
         var that=this;
         if (!this.context)
         {
          this.context = new qpid.common.ContextVariablesEditor({name: 'context', title: 'Context variables'});
          this.context.placeAt(dom.byId("editVirtualHost.context"));
         }
-        this.query = "api/latest/virtualhost/" + encodeURIComponent(hostData.nodeName) + "/" + encodeURIComponent(hostData.hostName);
-        this.dialog.set("title", "Edit Virtual Host - " + entities.encode(String(hostData.hostName)));
-        xhr.get(
+        this.dialog.set("title", "Edit Virtual Host - " + entities.encode(String(modelObj.name)));
+
+        management.load(modelObj, { actuals: true },
+            function(actualData)
             {
-              url: this.query,
-              sync: true,
-              content: { actuals: true },
-              handleAs: "json",
-              load: function(data)
-              {
-                that._show(data[0], hostData);
-              }
-            }
-        );
+                management.load(modelObj).then(
+                    function(effectiveData)
+                    {
+                        that._show(actualData[0], effectiveData[0]);
+                    },
+                    util.xhrErrorHandler);
+            },
+            util.xhrErrorHandler);
+
       },
       destroy: function()
       {
@@ -129,7 +130,7 @@ define(["dojo/_base/xhr",
                 data["context"] = context;
               }
               var that=this;
-              util.post(this.query, data, function(x){ that.dialog.hide();} );
+              this.management.update(that.modelObj, data, function(x){ that.dialog.hide();} );
           }
           else
           {
@@ -156,7 +157,7 @@ define(["dojo/_base/xhr",
             }
           }
 
-          this.context.load(this.query, {actualValues:actualData.context, effectiveValues:effectiveData.context});
+          util.setContextData(this.context, this.management, this.modelObj, actualData, effectiveData );
 
           // Add regexp to the numeric fields
           for(var i = 0; i < numericFieldNames.length; i++)
@@ -175,10 +176,11 @@ define(["dojo/_base/xhr",
              {
                 try
                 {
-                    TypeUI.show({containerNode:that.typeFieldsContainer, parent: that, data: actualData});
+                    var metadata = that.management.metadata;
+                    TypeUI.show({containerNode:that.typeFieldsContainer, parent: that, data: actualData, metadata: metadata});
                     that.form.connectChildren();
 
-                    util.applyToWidgets(that.allFieldsContainer, "VirtualHost", actualData.type, actualData);
+                    util.applyToWidgets(that.allFieldsContainer, "VirtualHost", actualData.type, actualData, metadata);
                 }
                 catch(e)
                 {

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHostNode.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHostNode.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHostNode.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHostNode.js Mon May  4 12:17:23 2015
@@ -18,8 +18,7 @@
  * under the License.
  *
  */
-define(["dojo/_base/xhr",
-        "dojox/html/entities",
+define(["dojox/html/entities",
         "dojo/_base/array",
         "dojo/_base/event",
         "dojo/_base/lang",
@@ -44,7 +43,7 @@ define(["dojo/_base/xhr",
         "dojox/validate/us",
         "dojox/validate/web",
         "dojo/domReady!"],
-  function (xhr, entities, array, event, lang, win, dom, domConstruct, registry, parser, json, query, Memory, ObjectStore, util, template)
+  function (entities, array, event, lang, win, dom, domConstruct, registry, parser, json, query, Memory, ObjectStore, util, template)
   {
     var virtualHostNodeEditor =
     {
@@ -68,28 +67,18 @@ define(["dojo/_base/xhr",
         this.form = registry.byId("editVirtualHostNodeForm");
         this.form.on("submit", function(){return false;});
       },
-      show: function(effectiveData)
+      show: function(management, modelObj, effectiveData)
       {
+        this.management = management;
+        this.modelObj = modelObj;
         var that=this;
         if (!this.context)
         {
          this.context = new qpid.common.ContextVariablesEditor({name: 'context', title: 'Context variables'});
          this.context.placeAt(dom.byId("editVirtualHostNode.context"));
         }
-        this.query = "api/latest/virtualhostnode/" + encodeURIComponent(effectiveData.name);
         this.dialog.set("title", "Edit Virtual Host Node - " + entities.encode(String(effectiveData.name)));
-        xhr.get(
-            {
-              url: this.query,
-              sync: true,
-              content: { actuals: true },
-              handleAs: "json",
-              load: function(data)
-              {
-                that._show(data[0], effectiveData);
-              }
-            }
-        );
+        management.load( modelObj, { actuals: true }, function(data){that._show(data[0], effectiveData);});
       },
       destroy: function()
       {
@@ -121,7 +110,7 @@ define(["dojo/_base/xhr",
                 data["context"] = context;
               }
               var that = this;
-              util.post(this.query, data, function(x){ that.dialog.hide();} );
+              this.management.update(that,modelObj, data, function(x){ that.dialog.hide();}, util.xhrErrorHandler );
           }
           else
           {
@@ -132,10 +121,11 @@ define(["dojo/_base/xhr",
       {
           this.initialData = actualData;
           this.name.set("value", actualData.name);
-          this.context.load( this.query, {actualValues: actualData.context, effectiveValues: effectiveData.context});
 
           var that = this;
 
+          util.setContextData(this.context, this.management, this.modelObj, actualData, effectiveData );
+
           var widgets = registry.findWidgets(this.typeFieldsContainer);
           array.forEach(widgets, function(item) { item.destroyRecursive();});
           domConstruct.empty(this.typeFieldsContainer);
@@ -145,10 +135,11 @@ define(["dojo/_base/xhr",
              {
                 try
                 {
-                    TypeUI.show({containerNode:that.typeFieldsContainer, parent: that, data: actualData, effectiveData: effectiveData});
+                    var metadata = that.management.metadata;
+                    TypeUI.show({containerNode:that.typeFieldsContainer, parent: that, data: actualData, effectiveData: effectiveData, metadata: metadata});
                     that.form.connectChildren();
 
-                    util.applyToWidgets(that.allFieldsContainer, "VirtualHostNode", actualData.type, actualData);
+                    util.applyToWidgets(that.allFieldsContainer, "VirtualHostNode", actualData.type, actualData, metadata);
                 }
                 catch(e)
                 {

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/group/Group.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/group/Group.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/group/Group.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/group/Group.js Mon May  4 12:17:23 2015
@@ -18,8 +18,7 @@
  * under the License.
  *
  */
-define(["dojo/_base/xhr",
-        "dojo/parser",
+define(["dojo/parser",
         "dojo/query",
         "dijit/registry",
         "dojo/_base/connect",
@@ -35,21 +34,18 @@ define(["dojo/_base/xhr",
         "dojo/data/ObjectStore",
         "qpid/management/group/addGroupMember",
         "dojox/html/entities",
+        "dojo/text!group/showGroup.html",
         "dojox/grid/enhanced/plugins/Pagination",
         "dojox/grid/enhanced/plugins/IndirectSelection",
         "dojo/domReady!"],
-       function (xhr, parser, query, registry, connect, event, json, properties, updater, util, formatter,
-                 UpdatableStore, JsonRest, EnhancedGrid, ObjectStore, addGroupMember, entities) {
+       function (parser, query, registry, connect, event, json, properties, updater, util, formatter,
+                 UpdatableStore, JsonRest, EnhancedGrid, ObjectStore, addGroupMember, entities, showGroup) {
 
            function Group(name, parent, controller) {
                this.name = name;
                this.controller = controller;
-               this.modelObj = { type: "group", name: name };
-
-               if(parent) {
-                   this.modelObj.parent = {};
-                   this.modelObj.parent[ parent.type] = parent;
-               }
+               this.management = management;
+               this.modelObj = { type: "group", name: name, parent: parent };
            }
 
            Group.prototype.getGroupName = function()
@@ -60,7 +56,7 @@ define(["dojo/_base/xhr",
 
            Group.prototype.getGroupProviderName = function()
            {
-               return this.modelObj.parent.groupprovider.name;
+               return this.modelObj.parent.name;
            };
 
            Group.prototype.getTitle = function()
@@ -72,36 +68,36 @@ define(["dojo/_base/xhr",
                var that = this;
                this.contentPane = contentPane;
 
-               xhr.get({url: "group/showGroup.html",
-                        sync: true,
-                        load:  function(data) {
-                            contentPane.containerNode.innerHTML = data;
-                            parser.parse(contentPane.containerNode).then(function(instances)
-                            {
-                            that.groupUpdater = new GroupUpdater(contentPane.containerNode, that, that.controller);
-                            that.groupUpdater.update();
-                            updater.add( that.groupUpdater );
-                            
+                {
+                    contentPane.containerNode.innerHTML = showGroup;
+                    parser.parse(contentPane.containerNode).then(function(instances)
+                    {
+                        that.groupUpdater = new GroupUpdater(contentPane.containerNode, that.modelObj, that.controller);
+                        that.groupUpdater.update(
+                        function()
+                        {
                             var addGroupMemberButton = query(".addGroupMemberButton", contentPane.containerNode)[0];
                             connect.connect(registry.byNode(addGroupMemberButton), "onClick",
                                     function(evt){
-                                      addGroupMember.show(that.getGroupProviderName(), that.getGroupName())
+                                      addGroupMember.show(that.getGroupProviderName(), that.modelObj, that.controller.management);
                                }
                             );
 
                             var removeGroupMemberButton = query(".removeGroupMemberButton", contentPane.containerNode)[0];
                             connect.connect(registry.byNode(removeGroupMemberButton), "onClick",
                                     function(evt){
-                                        util.deleteGridSelections(
-                                                that.groupUpdater,
+                                        util.deleteSelectedObjects(
                                                 that.groupUpdater.groupMembersUpdatableStore.grid,
-                                                "api/latest/groupmember/"+ encodeURIComponent(that.getGroupProviderName()) +
-                                                 "/" + encodeURIComponent(that.getGroupName()),
-                                                "Are you sure you want to remove group member");
+                                                "Are you sure you want to remove group member",
+                                                that.management,
+                                                {type: "groupmember", parent: that.modelObj},
+                                                that.groupUpdater);
                                 }
                             );
-                            });
-                        }});
+                            updater.add( that.groupUpdater);
+                        });
+                    });
+                };
            };
 
            Group.prototype.close = function() {
@@ -110,6 +106,8 @@ define(["dojo/_base/xhr",
 
            function GroupUpdater(containerNode, groupObj, controller)
            {
+               this.management = controller.management;
+               this.modelObj = {type: "groupmember", parent:groupObj};
                var that = this;
 
                function findNode(name) {
@@ -128,10 +126,9 @@ define(["dojo/_base/xhr",
                            "durable",
                            "lifetimePolicy",
                            "type"]);
-               this.name.innerHTML = entities.encode(String(groupObj.getGroupName()));
-               this.query = "api/latest/groupmember/"+ encodeURIComponent(groupObj.getGroupProviderName()) + "/" + encodeURIComponent(groupObj.getGroupName());
+               this.name.innerHTML = entities.encode(String(groupObj.name));
 
-               xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}).then(function(data)
+               this.management.load(this.modelObj).then(function(data)
                                {
                                    that.groupMemberData = data;
 
@@ -163,40 +160,40 @@ define(["dojo/_base/xhr",
                                                                          });
                                                         } , gridProperties, EnhancedGrid);
 
-                               });
+                               }, util.xhrErrorHandler);
 
            }
 
-           GroupUpdater.prototype.update = function()
+           GroupUpdater.prototype.update = function( callback)
            {
 
                var that = this;
 
-               xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"})
+               this.management.load(this.modelObj)
                   .then(function(data) {
                       that.groupMemberData = data;
 
                       util.flattenStatistics( that.groupMemberData );
 
+                      if (callback)
+                      {
+                        callback();
+                      }
                       that.groupMembersUpdatableStore.update(that.groupMemberData);
-                  });
+                  }, util.xhrErrorHandler);
            };
 
            Group.prototype.deleteGroupMember = function() {
-               if(confirm("Are you sure you want to delete group member'" +this.name+"'?")) {
-                   var query = "api/latest/groupmember/"+ encodeURIComponent(this.getGroupProviderName()) + "/" + encodeURIComponent(this.name);
+               if(confirm("Are you sure you want to delete group members of group '" +this.name+"'?")) {
                    this.success = true
                    var that = this;
-                   xhr.del({url: query, sync: true, handleAs: "json"}).then(
+                   this.management.remove({type: "groupmember", parent: this.modelObj}).then(
                        function(data) {
                            that.contentPane.onClose()
                            that.controller.tabContainer.removeChild(that.contentPane);
                            that.contentPane.destroyRecursive();
                        },
-                       function(error) {that.success = false; that.failureReason = error;});
-                   if(!this.success ) {
-                       util.xhrErrorHandler(this.failureReason);
-                   }
+                       util.xhrErrorHandler);
                }
            }
 

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/group/addGroupMember.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/group/addGroupMember.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/group/addGroupMember.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/group/addGroupMember.js Mon May  4 12:17:23 2015
@@ -18,8 +18,7 @@
  * under the License.
  *
  */
-define(["dojo/_base/xhr",
-        "dojo/dom",
+define(["dojo/dom",
         "dojo/dom-construct",
         "dojo/_base/window",
         "dijit/registry",
@@ -28,6 +27,7 @@ define(["dojo/_base/xhr",
         "dojo/_base/event",
         "dojo/_base/json",
         "qpid/common/util",
+        "dojo/text!group/addGroupMember.html",
         "dijit/form/NumberSpinner", // required by the form
         /* dojox/ validate resources */
         "dojox/validate/us", "dojox/validate/web",
@@ -42,7 +42,7 @@ define(["dojo/_base/xhr",
         /* basic dojox classes */
         "dojox/form/BusyButton", "dojox/form/CheckedMultiSelect",
         "dojo/domReady!"],
-    function (xhr, dom, construct, win, registry, parser, array, event, json, util) {
+    function (dom, construct, win, registry, parser, array, event, json, util, template) {
 
         var addGroupMember = {};
 
@@ -55,11 +55,9 @@ define(["dojo/_base/xhr",
                 return newGroupMember;
             };
 
-        xhr.get({url: "group/addGroupMember.html",
-                 sync: true,
-                 load:  function(data) {
+                        {
                             var theForm;
-                            node.innerHTML = data;
+                            node.innerHTML = template;
                             addGroupMember.dialogNode = dom.byId("addGroupMember");
                             parser.instantiate([addGroupMember.dialogNode]);
 
@@ -71,10 +69,7 @@ define(["dojo/_base/xhr",
 
                                     var newGroupMember = convertToGroupMember(theForm.getValues());
                                     var that = this;
-
-                                    var url = "api/latest/groupmember/"+encodeURIComponent(addGroupMember.groupProvider) +
-                                              "/" + encodeURIComponent(addGroupMember.group);
-                                    util.post(url, newGroupMember, function(x){registry.byId("addGroupMember").hide();});
+                                    addGroupMember.management.create("groupmember", addGroupMember.group, newGroupMember, function(x){registry.byId("addGroupMember").hide();});
                                     return false;
 
 
@@ -84,11 +79,12 @@ define(["dojo/_base/xhr",
                                 }
 
                             });
-                        }});
+                        };
 
-        addGroupMember.show = function(groupProvider, group) {
+        addGroupMember.show = function(groupProvider, groupModel, management) {
+                            addGroupMember.management = management;
                             addGroupMember.groupProvider = groupProvider;
-                            addGroupMember.group = group;
+                            addGroupMember.group = groupModel;
                             registry.byId("formAddGroupMember").reset();
                             registry.byId("addGroupMember").show();
                         };

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/GroupManagingGroupProvider.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/GroupManagingGroupProvider.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/GroupManagingGroupProvider.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/GroupManagingGroupProvider.js Mon May  4 12:17:23 2015
@@ -18,8 +18,7 @@
  * under the License.
  *
  */
-define(["dojo/_base/xhr",
-        "dojo/dom",
+define(["dojo/dom",
         "dojo/parser",
         "dojo/query",
         "dojo/dom-construct",
@@ -35,6 +34,7 @@ define(["dojo/_base/xhr",
         "qpid/common/UpdatableStore",
         "dojox/grid/EnhancedGrid",
         "dojo/text!groupprovider/showGroupManagingGroupProvider.html",
+        "dojo/text!groupprovider/addGroup.html",
         "dojox/grid/enhanced/plugins/Pagination",
         "dojox/grid/enhanced/plugins/IndirectSelection",
         "dojox/validate/us", "dojox/validate/web",
@@ -45,8 +45,8 @@ define(["dojo/_base/xhr",
         "dijit/form/Form",
         "dijit/form/DateTextBox",
         "dojo/domReady!"],
-    function (xhr, dom, parser, query, construct, connect, win, event, json, registry, entities, util, properties,
-              updater, UpdatableStore, EnhancedGrid, template)
+    function (dom, parser, query, construct, connect, win, event, json, registry, entities, util, properties,
+              updater, UpdatableStore, EnhancedGrid, template, addGroupTemplate)
     {
         function GroupManagingGroupProvider(containerNode, groupProviderObj, controller)
         {
@@ -55,6 +55,7 @@ define(["dojo/_base/xhr",
             this.name = groupProviderObj.name;
             node.innerHTML = template;
             this.controller = controller;
+            this.modelObj = groupProviderObj;
             parser.parse(node).then(function(instances)
             {
                      var groupDiv = query(".groups", node)[0];
@@ -87,7 +88,7 @@ define(["dojo/_base/xhr",
                                               });
                                       }, gridProperties, EnhancedGrid);
                      var addGroupButton = query(".addGroupButton", node)[0];
-                     registry.byNode(addGroupButton).on("click", function(evt){ addGroup.show(groupProviderObj.name) });
+                     registry.byNode(addGroupButton).on("click", function(evt){ addGroup.show(groupProviderObj, controller.management) });
                      var deleteWidget = registry.byNode(query(".deleteGroupButton", node)[0]);
                      deleteWidget.on("click", function(evt){ event.stop(evt); that.deleteGroups(); });
             });
@@ -100,31 +101,21 @@ define(["dojo/_base/xhr",
             if(data.length) {
                 var that = this;
                 if(confirm("Delete " + data.length + " groups?")) {
-                    var i, queryParam;
+                    var i;
+                    var parameters ={id:[]};
                     for(i = 0; i<data.length; i++) {
-                        if(queryParam) {
-                            queryParam += "&";
-                        } else {
-                            queryParam = "?";
-                        }
-
-                        queryParam += "id=" + data[i].id;
+                        parameters.id.push(data[i].id);
                     }
-                    var query = "api/latest/group/"+ encodeURIComponent(that.name)
-                       + queryParam;
-                    that.success = true
-                    xhr.del({url: query, sync: true, handleAs: "json"}).then(
+
+                    this.controller.management.remove({type: "group", parent: this.modelObj}, parameters).then(
                         function(data) {
                             grid.setQuery({id: "*"});
                             grid.selection.deselectAll();
                             that.update();
                         },
-                        function(error) {that.success = false; that.failureReason = error;});
-                    if(!that.success ) {
-                        util.xhrErrorHandler(this.failureReason);
-                    }
+                        util.xhrErrorHandler);
                 }
-}
+            }
         };
 
         GroupManagingGroupProvider.prototype.update = function(data)
@@ -155,11 +146,9 @@ define(["dojo/_base/xhr",
             };
 
 
-        xhr.get({url: "groupprovider/addGroup.html",
-                 sync: true,
-                 load:  function(data) {
+                        {
                             var theForm;
-                            node.innerHTML = data;
+                            node.innerHTML = addGroupTemplate;
                             addGroup.dialogNode = dom.byId("addGroup");
                             parser.instantiate([addGroup.dialogNode]);
 
@@ -172,9 +161,7 @@ define(["dojo/_base/xhr",
                                 if(theForm.validate()){
 
                                     var newGroup = convertToGroup(theForm.getValues());
-
-                                    var url = "api/latest/group/"+encodeURIComponent(addGroup.groupProvider);
-                                    util.post(url, newGroup, function(x){registry.byId("addGroup").hide();});
+                                    addGroup.management.create("group", addGroup.groupProvider, newGroup, function(x){registry.byId("addGroup").hide();});
                                     return false;
 
 
@@ -184,9 +171,10 @@ define(["dojo/_base/xhr",
                                 }
 
                             });
-                        }});
+                        }
 
-        addGroup.show = function(groupProvider) {
+        addGroup.show = function(groupProvider, management) {
+            addGroup.management = management;
             addGroup.groupProvider = groupProvider;
             registry.byId("formAddGroup").reset();
             registry.byId("addGroup").show();

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/groupfile/add.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/groupfile/add.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/groupfile/add.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/groupfile/add.js Mon May  4 12:17:23 2015
@@ -18,14 +18,15 @@
  * under the License.
  *
  */
-define(["dojo/dom","dojo/query", "dojo/_base/array", "dijit/registry","qpid/common/util", "qpid/common/metadata"],
-    function (dom, query, array, registry, util, metadata)
+define(["dojo/dom","dojo/query", "dojo/_base/array", "dijit/registry","qpid/common/util",
+        "dojo/text!groupprovider/groupfile/add.html",],
+    function (dom, query, array, registry, util, template)
     {
 
         return {    show: function(data)
                     {
                         var that=this;
-                        util.parseHtmlIntoDiv(data.containerNode, "groupprovider/groupfile/add.html",
+                        util.parse(data.containerNode, template,
                         function()
                         {
                             if (data.data)

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/groupfile/show.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/groupfile/show.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/groupfile/show.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/groupfile/show.js Mon May  4 12:17:23 2015
@@ -19,7 +19,7 @@
  *
  */
 define(["qpid/common/util", "dojo/domReady!"],
-  function (util, metadata)
+  function (util)
   {
 
     function GroupFile(data)

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/managedgroupprovider/add.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/managedgroupprovider/add.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/managedgroupprovider/add.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/managedgroupprovider/add.js Mon May  4 12:17:23 2015
@@ -19,7 +19,7 @@
  *
  */
 define([],
-    function (dom, query, array, registry, util, metadata)
+    function ()
     {
         return { show: function(data) { /* nothing to do */ } };
     }

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/logs/LogFileDownloadDialog.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/logs/LogFileDownloadDialog.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/logs/LogFileDownloadDialog.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/logs/LogFileDownloadDialog.js Mon May  4 12:17:23 2015
@@ -28,7 +28,6 @@ define([
   "dojo/parser",
   "dojo/store/Memory",
   "dojo/data/ObjectStore",
-  "qpid/management/UserPreferences",
   "dojo/number",
   "dijit/registry",
   "dijit/Dialog",
@@ -36,7 +35,7 @@ define([
   "dojox/grid/EnhancedGrid",
   "dojo/text!../../../logs/showLogFileDownloadDialog.html",
   "dojo/domReady!"
-], function(declare, event, xhr, connect, domConstruct, query, parser, Memory, ObjectStore, UserPreferences, number,
+], function(declare, event, xhr, connect, domConstruct, query, parser, Memory, ObjectStore, number,
     registry, Dialog, Button, EnhancedGrid, template){
 
 
@@ -54,6 +53,7 @@ return declare("qpid.management.logs.Log
         var that = this;
         this.containerNode = domConstruct.create("div", {innerHTML: template});
         parser.parse(this.containerNode).then(function(instances){that._postParse();});
+        this.userPreferences = args.userPreferences;
     },
     _postParse: function()
     {
@@ -83,7 +83,7 @@ return declare("qpid.management.logs.Log
           },
           { name: "Last Modified", field: "lastModified", width: "250px",
               formatter: function(val) {
-                return UserPreferences.formatDateTime(val, {addOffset: true, appendTimeZone: true});
+                return that.userPreferences.formatDateTime(val, {addOffset: true, appendTimeZone: true});
               }
           }
         ];

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/logs/LogViewer.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/logs/LogViewer.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/logs/LogViewer.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/logs/LogViewer.js Mon May  4 12:17:23 2015
@@ -23,29 +23,28 @@ define(["dojo/_base/xhr",
         "dojo/query",
         "dojo/date/locale",
         "dijit/registry",
-        "qpid/management/UserPreferences",
         "qpid/common/grid/GridUpdater",
         "qpid/common/grid/UpdatableGrid",
         "qpid/management/logs/LogFileDownloadDialog",
         "dojo/text!../../../logs/showLogViewer.html",
         "dojo/domReady!"],
-       function (xhr, parser, query, locale, registry, UserPreferences, GridUpdater, UpdatableGrid, LogFileDownloadDialog, markup) {
+       function (xhr, parser, query, locale, registry, GridUpdater, UpdatableGrid, LogFileDownloadDialog, markup) {
 
            var defaulGridRowLimit = 4096;
            var currentTimeZone;
 
-           function dataTransformer(data)
+           function dataTransformer(data, userPreferences)
            {
              for(var i=0; i < data.length; i++)
              {
-               data[i].time = UserPreferences.addTimeZoneOffsetToUTC(data[i].timestamp);
+               data[i].time = userPreferences.addTimeZoneOffsetToUTC(data[i].timestamp);
              }
              return data;
            }
 
            function LogViewer(name, parent, controller) {
                var self = this;
-
+               this.management = controller.management;
                this.name = name;
                this.lastLogId = 0;
                this.contentPane = null;
@@ -69,7 +68,7 @@ define(["dojo/_base/xhr",
                var self = this;
 
                this.downloadLogsButton = registry.byNode(query(".downloadLogs", this.contentPane.containerNode)[0]);
-               this.downloadLogDialog = new LogFileDownloadDialog();
+               this.downloadLogDialog = new LogFileDownloadDialog({userPreferences:this.management.userPreferences});
 
                this.downloadLogsButton.on("click", function(evt){
                    self.downloadLogDialog.showDialog();
@@ -79,8 +78,8 @@ define(["dojo/_base/xhr",
 
            LogViewer.prototype._buildGrid = function() {
                var self = this;
-               currentTimeZone = UserPreferences.getTimeZoneDescription();
-
+               var userPreferences = this.management.userPreferences;
+               currentTimeZone = userPreferences.getTimeZoneDescription();
                var gridStructure = [
                     {
                       hidden: false,
@@ -93,12 +92,12 @@ define(["dojo/_base/xhr",
                     {
                       name: "Date", field: "time", width: "100px", datatype: "date",
                         formatter: function(val) {
-                        return UserPreferences.formatDateTime(val, {selector:"date"});
+                        return userPreferences.formatDateTime(val, {selector:"date"});
                       }
                     },
                     { name: "Time ", field: "time", width: "100px", datatype: "time",
                      formatter: function(val) {
-                       return UserPreferences.formatDateTime(val, {selector:"time"});
+                       return userPreferences.formatDateTime(val, {selector:"time"});
                      }
                    },
                    {
@@ -122,6 +121,7 @@ define(["dojo/_base/xhr",
                try
                {
                  var updater = new GridUpdater({
+                     userPreferences: userPreferences,
                      updatable: false,
                      serviceUrl: function()
                      {
@@ -148,7 +148,7 @@ define(["dojo/_base/xhr",
                      },
                      append: true,
                      appendLimit: defaulGridRowLimit,
-                     dataTransformer: dataTransformer
+                     dataTransformer: function(data){ return dataTransformer(data, userPreferences);}
                  });
                  this.grid = new UpdatableGrid(updater.buildUpdatableGridArguments({
                      structure: gridStructure,
@@ -187,7 +187,7 @@ define(["dojo/_base/xhr",
                  };
                  this.grid.on("styleRow", onStyleRow);
                  this.grid.startup();
-                 UserPreferences.addListener(this);
+                 userPreferences.addListener(this);
                }
                catch(err)
                {
@@ -199,7 +199,7 @@ define(["dojo/_base/xhr",
            };
 
            LogViewer.prototype.close = function() {
-             UserPreferences.removeListener(this);
+             this.management.userPreferences.removeListener(this);
              if (this.grid)
              {
                  this.grid.destroy();
@@ -219,8 +219,9 @@ define(["dojo/_base/xhr",
 
            LogViewer.prototype.onPreferencesChange = function(data)
            {
-             currentTimeZone = UserPreferences.getTimeZoneDescription();
-             dataTransformer(this.grid.updater.memoryStore.data);
+             var userPreferences = this.management.userPreferences;
+             currentTimeZone = userPreferences.getTimeZoneDescription();
+             dataTransformer(this.grid.updater.memoryStore.data, userPreferences);
              this.grid._refresh();
            };
 

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/moveCopyMessages.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/moveCopyMessages.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/moveCopyMessages.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/moveCopyMessages.js Mon May  4 12:17:23 2015
@@ -15,8 +15,7 @@
  * limitations under the License.
  */
 
-define(["dojo/_base/xhr",
-        "dojo/dom",
+define(["dojo/dom",
         "dojo/dom-construct",
         "dojo/_base/window",
         "dijit/registry",
@@ -28,18 +27,18 @@ define(["dojo/_base/xhr",
         "dijit/form/FilteringSelect",
         "dojo/query",
         "dojo/_base/connect",
+        "qpid/common/util",
+        "dojo/text!moveCopyMessages.html",
         "dojo/domReady!"],
-    function (xhr, dom, construct, win, registry, parser, array, event, json, Memory, FilteringSelect, query, connect) {
+    function (dom, construct, win, registry, parser, array, event, json, Memory, FilteringSelect, query, connect, util, template) {
 
         var moveMessages = {};
 
         var node = construct.create("div", null, win.body(), "last");
 
-        xhr.get({url: "moveCopyMessages.html",
-                 sync: true,
-                 load:  function(data) {
+
                             var theForm;
-                            node.innerHTML = data;
+                            node.innerHTML = template;
                             moveMessages.dialogNode = dom.byId("moveMessages");
                             parser.instantiate([moveMessages.dialogNode]);
 
@@ -62,23 +61,17 @@ define(["dojo/_base/xhr",
                                     moveMessages.data.destinationQueue = theForm.getValues()["queue"];
                                     var that = this;
 
-                                    xhr.post({url: "service/message/"+encodeURIComponent(moveMessages.vhost)
+                                    moveMessages.management.post({url: "service/message/"+encodeURIComponent(moveMessages.vhost)
                                                       +"/"+encodeURIComponent(moveMessages.queue),
-                                             sync: true, handleAs: "json",
-                                             headers: { "Content-Type": "application/json"},
-                                             postData: json.toJson(moveMessages.data),
-                                             load: function(x) {that.success = true; },
-                                             error: function(error) {that.success = false; that.failureReason = error;}});
-
-                                    if(this.success === true) {
-                                        registry.byId("moveMessages").hide();
-                                        if(moveMessages.next) {
-                                            moveMessages.next();
-                                        }
-                                    } else {
-                                        alert("Error:" + this.failureReason);
-                                    }
-
+                                             headers: { "Content-Type": "application/json"}},
+                                             moveMessages.data,
+                                             function(x) {
+                                                          registry.byId("moveMessages").hide();
+                                                          if(moveMessages.next) {
+                                                              moveMessages.next();
+                                                          }
+                                             },
+                                             util.xhrErrorHandler);
                                     return false;
 
 
@@ -89,21 +82,18 @@ define(["dojo/_base/xhr",
 
                             });
 
-                        }});
-
-        moveMessages.show = function(obj, next) {
+        moveMessages.show = function(management, modelObj, data, next) {
             var that = this;
-
-            moveMessages.vhost = obj.virtualhost;
-            moveMessages.queue = obj.queue;
-            moveMessages.data = obj.data;
+            moveMessages.management = management;
+            moveMessages.vhost = modelObj.parent.name;
+            moveMessages.queue = modelObj.name;
+            moveMessages.data = data;
             moveMessages.next = next;
             registry.byId("formMoveMessages").reset();
 
 
 
-            xhr.get({url: "api/latest/queue/" + encodeURIComponent(obj.virtualhost) + "?depth=0",
-                     handleAs: "json"}).then(
+            management.load({type: "queue", parent: modelObj.parent},  {depth:0}).then(
                 function(data) {
                     var queues =  [];
                     for(var i=0; i < data.length; i++) {
@@ -128,7 +118,7 @@ define(["dojo/_base/xhr",
                     registry.byId("moveMessages").show();
 
 
-                });
+                }, util.xhrErrorHandler);
 
 
         };



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message