qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oru...@apache.org
Subject svn commit: r1677590 [4/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/UserPreferences.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/UserPreferences.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/UserPreferences.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/UserPreferences.js Mon May  4 12:17:23 2015
@@ -18,296 +18,267 @@
  * under the License.
  *
  */
-define(["dojo/_base/xhr",
-        "dojo/json",
-        "dojo/date",
+define(["dojo/date",
         "dojo/date/locale",
-        "dojo/number",
-        "qpid/common/timezone"], function (xhr, json, date, locale, number, timezone) {
+        "dojo/number"], function (date, locale, number) {
 
-  var listeners = [];
+  function UserPreferences(management)
+  {
+      this.listeners = [];
+      /* set time zone to 'UTC' by default*/
+      this.timeZone = "UTC";
+      this.tabs = [];
+      this.management = management;
+  }
 
-  var UserPreferences = {
-
-    /* set time zone to 'UTC' by default*/
-    timeZone: "UTC",
-    tabs: [],
-
-    loadPreferences : function(callbackSuccessFunction, callbackErrorFunction)
-    {
+  UserPreferences.prototype.load = function(successCallback, failureCallback)
+  {
       var that = this;
-      xhr.get({
-        url: "service/preferences",
-        sync: true,
-        handleAs: "json",
-        load: function(data)
-        {
-          for(var name in data)
-          {
-            that[name] = data[name];
-          }
-          if (callbackSuccessFunction)
-          {
-            callbackSuccessFunction();
-          }
-       },
-       error: function(error)
-       {
-         if (callbackErrorFunction)
-         {
-           callbackErrorFunction(error);
-         }
-       }
-      });
-    },
+      this.management.get({url: "service/preferences"},
+                       function(preferences)
+                       {
+                          that.preferences = preferences;
+                          for(var name in preferences)
+                          {
+                              that[name] = preferences[name];
+                          }
+                          if (successCallback)
+                          {
+                              successCallback();
+                          }
+                       },
+                       function(error){that.preferencesError = error;});
+  }
 
-    setPreferences : function(preferences, callbackSuccessFunction, callbackErrorFunction, noSync)
-    {
+  UserPreferences.prototype.save = function(preferences, successCallback, failureCallback)
+  {
       var that = this;
-      xhr.post({
-        url: "service/preferences",
-        sync: !noSync,
-        handleAs: "json",
-        headers: { "Content-Type": "application/json"},
-        postData: json.stringify(preferences),
-        load: function(x)
-        {
-          for(var name in preferences)
-          {
-            if (preferences.hasOwnProperty(name))
-            that[name] = preferences[name];
-          }
-          that._notifyListeners(preferences);
-          if (callbackSuccessFunction)
-          {
-            callbackSuccessFunction(preferences);
-          }
-        },
-        error: function(error)
-        {
-          if (callbackErrorFunction)
-          {
-            callbackErrorFunction(error);
-          }
-        }
-      });
-    },
+      this.management.post({url: "service/preferences"},
+                          preferences,
+                          function(x)
+                          {
+                            that.preferences = preferences;
+                            for(var name in preferences)
+                            {
+                              if (preferences.hasOwnProperty(name))
+                              {
+                                  that[name] = preferences[name];
+                              }
+                            }
+                            that._notifyListeners(preferences);
+                            if (successCallback)
+                            {
+                              successCallback(preferences);
+                            }
+                          },
+                          failureCallback);
+  };
 
-    resetPreferences : function()
-    {
+  var fields = ["preferencesError", "management", "listeners"];
+  UserPreferences.prototype.resetPreferences = function()
+  {
       var preferences = {};
       for(var name in this)
       {
-        if (this.hasOwnProperty(name) && typeof this[name] != "function")
-        {
-          if (name == "preferencesError")
+          if (this.hasOwnProperty(name) && typeof this[name] != "function")
           {
-            continue;
+              if (fields.indexOf(name) != -1)
+              {
+                  continue;
+              }
+              this[name] = null;
+              preferences[name] = undefined;
+              delete preferences[name];
           }
-          this[name] = null;
-          preferences[name] = undefined;
-          delete preferences[name];
-        }
       }
+      this.timeZone = "UTC";
+      this.preferences ="UTC";
+      this.preferences = preferences;
       this._notifyListeners(preferences);
-    },
+  };
 
-    addListener : function(obj)
-    {
-      listeners.push(obj);
-    },
+  UserPreferences.prototype.addListener = function(obj)
+  {
+    this.listeners.push(obj);
+    this._notifyListener(obj, this.preferences);
+  };
 
-    removeListener : function(obj)
+  UserPreferences.prototype.removeListener = function(obj)
+  {
+    for(var i = 0; i < this.listeners.length; i++)
     {
-      for(var i = 0; i < listeners.length; i++)
+      if(this.listeners[i] === obj)
       {
-        if(listeners[i] === obj)
-        {
-          listeners.splice(i,1);
-          return;
-        }
+        this.listeners.splice(i,1);
+        return;
       }
-    },
+    }
+  };
 
-    _notifyListeners : function(preferences)
+  UserPreferences.prototype._notifyListeners = function(preferences)
+  {
+    for(var i = 0; i < this.listeners.length; i++)
     {
-      for(var i = 0; i < listeners.length; i++)
-      {
-        try
-        {
-          listeners[i].onPreferencesChange(preferences);
-        }
-        catch(e)
-        {
-          if (console && console.warn)
-          {
-            console.warn(e);
-          }
-        }
-      }
-    },
+      this._notifyListener(this.listeners[i], preferences);
+    }
+  };
+
+  UserPreferences.prototype._notifyListener = function(listener,preferences)
+  {
+     try
+     {
+       listener.onPreferencesChange(preferences);
+     }
+     catch(e)
+     {
+       if (console && console.warn)
+       {
+         console.warn(e);
+       }
+     }
+  };
 
-    getTimeZoneInfo : function(timeZoneName)
+  UserPreferences.prototype.getTimeZoneInfo = function(timeZoneName)
+  {
+    if (!timeZoneName && this.timeZone)
     {
-      if (!timeZoneName && this.timeZone)
-      {
-        timeZoneName = this.timeZone;
-      }
+      timeZoneName = this.timeZone;
+    }
 
-      if (!timeZoneName)
-      {
-        return null;
-      }
+    if (!timeZoneName)
+    {
+      return null;
+    }
 
-      return timezone.getTimeZoneInfo(timeZoneName);
-    },
+    return this.management.timezone.getTimeZoneInfo(timeZoneName);
+  };
 
-    addTimeZoneOffsetToUTC : function(utcTimeInMilliseconds, timeZone)
+  UserPreferences.prototype.addTimeZoneOffsetToUTC = function(utcTimeInMilliseconds, timeZone)
+  {
+    var tzi = null;
+    if (timeZone && timeZone.hasOwnProperty("offset"))
     {
-      var tzi = null;
-      if (timeZone && timeZone.hasOwnProperty("offset"))
-      {
-        tzi = timeZone;
-      }
-      else
-      {
-        tzi = this.getTimeZoneInfo(timeZone);
-      }
-
-      if (tzi)
-      {
-        var browserTimeZoneOffsetInMinutes = -new Date().getTimezoneOffset();
-        return utcTimeInMilliseconds + ( tzi.offset - browserTimeZoneOffsetInMinutes ) * 60000;
-      }
-      return utcTimeInMilliseconds;
-    },
+      tzi = timeZone;
+    }
+    else
+    {
+      tzi = this.getTimeZoneInfo(timeZone);
+    }
 
-    getTimeZoneDescription : function(timeZone)
+    if (tzi)
     {
-      var tzi = null;
-      if (timeZone && timeZone.hasOwnProperty("offset"))
-      {
-        tzi = timeZone;
-      }
-      else
-      {
-        tzi = this.getTimeZoneInfo(timeZone);
-      }
+      var browserTimeZoneOffsetInMinutes = -new Date().getTimezoneOffset();
+      return utcTimeInMilliseconds + ( tzi.offset - browserTimeZoneOffsetInMinutes ) * 60000;
+    }
+    return utcTimeInMilliseconds;
+  };
 
-      if (tzi)
-      {
-        var timeZoneOfsetInMinutes = tzi.offset;
-        return (timeZoneOfsetInMinutes>0? "+" : "")
-          + number.format(timeZoneOfsetInMinutes/60, {pattern: "00"})
-          + ":" + number.format(timeZoneOfsetInMinutes%60, {pattern: "00"})
-          + " " + tzi.name;
-      }
-      return date.getTimezoneName(new Date());
-    },
+  UserPreferences.prototype.getTimeZoneDescription = function(timeZone)
+  {
+    var tzi = null;
+    if (timeZone && timeZone.hasOwnProperty("offset"))
+    {
+      tzi = timeZone;
+    }
+    else
+    {
+      tzi = this.getTimeZoneInfo(timeZone);
+    }
 
-    formatDateTime : function(utcTimeInMilliseconds, options)
+    if (tzi)
     {
-      var dateTimeOptions = options || {};
-      var tzi = this.getTimeZoneInfo(dateTimeOptions.timeZoneName);
-      var timeInMilliseconds = utcTimeInMilliseconds;
+      var timeZoneOfsetInMinutes = tzi.offset;
+      return (timeZoneOfsetInMinutes>0? "+" : "")
+        + number.format(timeZoneOfsetInMinutes/60, {pattern: "00"})
+        + ":" + number.format(timeZoneOfsetInMinutes%60, {pattern: "00"})
+        + " " + tzi.name;
+    }
+    return date.getTimezoneName(new Date());
+  };
 
-      if (tzi && dateTimeOptions.addOffset)
-      {
-        timeInMilliseconds = this.addTimeZoneOffsetToUTC(utcTimeInMilliseconds, tzi);
-      }
+  UserPreferences.prototype.formatDateTime = function(utcTimeInMilliseconds, options)
+  {
+    var dateTimeOptions = options || {};
+    var tzi = this.getTimeZoneInfo(dateTimeOptions.timeZoneName);
+    var timeInMilliseconds = utcTimeInMilliseconds;
 
-      var d = new Date(timeInMilliseconds);
+    if (tzi && dateTimeOptions.addOffset)
+    {
+      timeInMilliseconds = this.addTimeZoneOffsetToUTC(utcTimeInMilliseconds, tzi);
+    }
 
-      var formatOptions = {
-          datePattern: dateTimeOptions.datePattern || "yyyy-MM-dd",
-          timePattern: dateTimeOptions.timePattern || "HH:mm:ss.SSS"
-      };
+    var d = new Date(timeInMilliseconds);
 
-      if ("date" == dateTimeOptions.selector)
-      {
-        formatOptions.selector = "date";
-      }
-      else if ("time" == dateTimeOptions.selector)
-      {
-        formatOptions.selector = "time";
-      }
+    var formatOptions = {
+        datePattern: dateTimeOptions.datePattern || "yyyy-MM-dd",
+        timePattern: dateTimeOptions.timePattern || "HH:mm:ss.SSS"
+    };
 
-      var result = locale.format(d, formatOptions);
-      if(dateTimeOptions.appendTimeZone)
-      {
-        result += " (" + this.getTimeZoneDescription(tzi) + ")";
-      }
-      return result;
-    },
+    if ("date" == dateTimeOptions.selector)
+    {
+      formatOptions.selector = "date";
+    }
+    else if ("time" == dateTimeOptions.selector)
+    {
+      formatOptions.selector = "time";
+    }
 
-    defaultErrorHandler: function(error)
+    var result = locale.format(d, formatOptions);
+    if(dateTimeOptions.appendTimeZone)
     {
-      if (error.status == 404)
-      {
-        alert("Cannot perform preferences operation: authentication provider is not configured");
-      }
-      else
-      {
-        alert("Cannot perform preferences operation:" + error);
-      }
-    },
+      result += " (" + this.getTimeZoneDescription(tzi) + ")";
+    }
+    return result;
+  };
 
-    appendTab: function(tab)
+  UserPreferences.prototype.appendTab = function(tab)
+  {
+    if (!this.tabs)
     {
-      if (!this.tabs)
-      {
-        this.tabs = [];
-      }
-      if (!this.isTabStored(tab))
-      {
-        this.tabs.push(tab);
-        this.setPreferences({tabs: this.tabs}, null, this.defaultErrorHandler, true);
-      }
-    },
+      this.tabs = [];
+    }
+    if (!this.isTabStored(tab))
+    {
+      this.tabs.push(tab);
+      this.save({tabs: this.tabs});
+    }
+  };
 
-    removeTab: function(tab)
+  UserPreferences.prototype.removeTab = function(tab)
+  {
+    if (this.tabs)
     {
-      if (this.tabs)
+      var index = this._getTabIndex(tab);
+      if (index != -1)
       {
-        var index = this._getTabIndex(tab);
-        if (index != -1)
-        {
-          this.tabs.splice(index, 1);
-          this.setPreferences({tabs: this.tabs}, null, this.defaultErrorHandler, true);
-        }
+        this.tabs.splice(index, 1);
+        this.save({tabs: this.tabs});
       }
-    },
+    }
+  };
 
-    isTabStored: function(tab)
-    {
-      return this._getTabIndex(tab) != -1;
-    },
+  UserPreferences.prototype.isTabStored = function(tab)
+  {
+    return this._getTabIndex(tab) != -1;
+  };
 
-    _getTabIndex: function(tab)
+  UserPreferences.prototype._getTabIndex = function(tab)
+  {
+    var index = -1;
+    if (this.tabs)
     {
-      var index = -1;
-      if (this.tabs)
+      for(var i = 0 ; i < this.tabs.length ; i++)
       {
-        for(var i = 0 ; i < this.tabs.length ; i++)
+        var t = this.tabs[i];
+        if ( t.objectId == tab.objectId && t.objectType == tab.objectType )
         {
-          var t = this.tabs[i];
-          if ( t.objectId == tab.objectId && t.objectType == tab.objectType )
-          {
-            index = i;
-            break;
-          }
+          index = i;
+          break;
         }
       }
-      return index;
     }
-  };
-
-  UserPreferences.loadPreferences(null,
-      function(error)
-      {
-        UserPreferences.preferencesError = error;
-      }
-  );
+    return index;
+  }
 
   return UserPreferences;
 });
\ No newline at end of file

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHost.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHost.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHost.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHost.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",
         "dojo/_base/connect",
         "dijit/registry",
@@ -33,12 +32,14 @@ define(["dojo/_base/xhr",
         "qpid/management/addExchange",
         "dojox/grid/EnhancedGrid",
         "qpid/management/editVirtualHost",
+        "dojo/text!showVirtualHost.html",
         "dojo/domReady!"],
-       function (xhr, parser, query, connect, registry, entities, properties, updater, util, formatter, UpdatableStore, addQueue, addExchange, EnhancedGrid, editVirtualHost) {
+       function (parser, query, connect, registry, entities, properties, updater, util, formatter, UpdatableStore, addQueue, addExchange, EnhancedGrid, editVirtualHost, template) {
 
            function VirtualHost(name, parent, controller) {
                this.name = name;
                this.controller = controller;
+               this.management = controller.management;
                this.modelObj = { type: "virtualhost", name: name, parent: parent};
            }
 
@@ -50,43 +51,45 @@ define(["dojo/_base/xhr",
            VirtualHost.prototype.open = function(contentPane) {
                var that = this;
                this.contentPane = contentPane;
-               xhr.get({url: "showVirtualHost.html",
-                        sync: true,
-                        load:  function(data) {
-                            var containerNode = contentPane.containerNode;
-                            containerNode.innerHTML = data;
-                            parser.parse(containerNode).then(function(instances)
-                            {
+
+                    var containerNode = contentPane.containerNode;
+                    containerNode.innerHTML = template;
+                    parser.parse(containerNode).then(function(instances)
+                    {
                             that.vhostUpdater = new Updater(containerNode, that.modelObj, that.controller, that);
 
                             var addQueueButton = query(".addQueueButton", containerNode)[0];
                             connect.connect(registry.byNode(addQueueButton), "onClick", function(evt){
-                                addQueue.show({virtualhost:that.name,virtualhostnode:that.modelObj.parent.name})
+                                addQueue.show(that.management, that.modelObj)
                             });
 
                             var deleteQueueButton = query(".deleteQueueButton", containerNode)[0];
                             connect.connect(registry.byNode(deleteQueueButton), "onClick",
                                     function(evt){
-                                        util.deleteGridSelections(
-                                                that.vhostUpdater,
-                                                that.vhostUpdater.queuesGrid.grid,
-                                                "api/latest/queue/" + encodeURIComponent(that.modelObj.parent.name) + "/" + encodeURIComponent(that.name),
-                                                "Are you sure you want to delete queue");
+                                        util.deleteSelectedObjects(
+                                            that.vhostUpdater.queuesGrid.grid,
+                                            "Are you sure you want to delete queue",
+                                            that.management,
+                                            {type: "queue", parent:that.modelObj},
+                                            that.vhostUpdater);
                                 }
                             );
 
                             var addExchangeButton = query(".addExchangeButton", containerNode)[0];
-                            connect.connect(registry.byNode(addExchangeButton), "onClick", function(evt){ addExchange.show({virtualhost:that.name,virtualhostnode:that.modelObj.parent.name}) });
+                            connect.connect(registry.byNode(addExchangeButton), "onClick", function(evt){
+                                addExchange.show(that.management, that.modelObj);
+                            });
 
                             var deleteExchangeButton = query(".deleteExchangeButton", containerNode)[0];
                             connect.connect(registry.byNode(deleteExchangeButton), "onClick",
                                     function(evt)
                                     {
-                                        util.deleteGridSelections(
-                                                that.vhostUpdater,
-                                                that.vhostUpdater.exchangesGrid.grid,
-                                                "api/latest/exchange/"+ encodeURIComponent(that.modelObj.parent.name) + "/" + encodeURIComponent(that.name),
-                                                "Are you sure you want to delete exchange");
+                                        util.deleteSelectedObjects(
+                                            that.vhostUpdater.exchangesGrid.grid,
+                                            "Are you sure you want to delete exchange",
+                                            that.management,
+                                            {type: "exchange", parent:that.modelObj},
+                                            that.vhostUpdater);
                                     }
                             );
 
@@ -97,12 +100,8 @@ define(["dojo/_base/xhr",
                             that.downloadButton.on("click",
                               function(e)
                               {
-                                var iframe = document.createElement('iframe');
-                                iframe.id = "downloader_" + that.name;
-                                document.body.appendChild(iframe);
                                 var suggestedAttachmentName = encodeURIComponent(that.name + ".json");
-                                iframe.src = "/api/latest/virtualhost/" + encodeURIComponent(that.modelObj.parent.name) + "/" + encodeURIComponent(that.name) + "?extractInitialConfig=true&contentDispositionAttachmentFilename=" + suggestedAttachmentName;
-                                // It seems there is no way to remove this iframe in a manner that is cross browser compatible.
+                                that.management.download(that.modelObj, {extractInitialConfig: true, contentDispositionAttachmentFilename: suggestedAttachmentName });
                               }
                             );
 
@@ -113,10 +112,7 @@ define(["dojo/_base/xhr",
                                    if (confirm("Deletion of virtual host will delete message data.\n\n"
                                            + "Are you sure you want to delete virtual host  '" + entities.encode(String(that.name)) + "'?"))
                                    {
-                                     if (util.sendRequest("api/latest/virtualhost/" + encodeURIComponent(that.modelObj.parent.name) + "/" + encodeURIComponent( that.name) , "DELETE"))
-                                     {
-                                       that.destroy();
-                                     }
+                                     that.management.remove(that.modelObj).then(function(result){that.destroy();});
                                    }
                                  }
                             );
@@ -124,8 +120,7 @@ define(["dojo/_base/xhr",
                                function(event)
                                {
                                  that.startButton.set("disabled", true);
-                                 util.sendRequest("api/latest/virtualhost/" + encodeURIComponent(that.modelObj.parent.name) + "/" + encodeURIComponent( that.name),
-                                         "PUT", {desiredState: "ACTIVE"});
+                                 that.management.update(that.modelObj, {desiredState: "ACTIVE"}, null, util.xhrErrorHandler);
                                });
 
                             that.stopButton.on("click",
@@ -136,23 +131,18 @@ define(["dojo/_base/xhr",
                                          + entities.encode(String(that.name)) +"'?"))
                                  {
                                      that.stopButton.set("disabled", true);
-                                     util.sendRequest("api/latest/virtualhost/" + encodeURIComponent(that.modelObj.parent.name) + "/" + encodeURIComponent( that.name),
-                                             "PUT", {desiredState: "STOPPED"});
+                                     that.management.update(that.modelObj, {desiredState: "STOPPED"}, null, util.xhrErrorHandler);
                                  }
                                });
 
                             that.editButton.on("click",
                                 function(event)
                                 {
-                                    editVirtualHost.show({nodeName:that.modelObj.parent.name,hostName:that.name});
+                                    editVirtualHost.show(that.management, that.modelObj);
                                 });
 
-                            that.vhostUpdater.update();
-                            updater.add( that.vhostUpdater );
-                            });
-
-                        }});
-
+                            that.vhostUpdater.update(function(){updater.add( that.vhostUpdater );});
+                    });
            };
 
            VirtualHost.prototype.close = function() {
@@ -170,6 +160,8 @@ define(["dojo/_base/xhr",
            function Updater(node, vhost, controller, virtualHost)
            {
                this.virtualHost = virtualHost;
+               this.management = controller.management;
+               this.modelObj = vhost;
                var that = this;
 
                function findNode(name) {
@@ -206,15 +198,9 @@ define(["dojo/_base/xhr",
                            "virtualHostChildren"
                            ]);
 
-               this.query = "api/latest/virtualhost/"+ encodeURIComponent(vhost.parent.name) + "/" + encodeURIComponent(vhost.name);
-
                var that = this;
 
-               xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}).then(function(data) {
-                   that.vhostData = data[0];
-
-                       // flatten statistics into attributes
-                       util.flattenStatistics( that.vhostData );
+                   that.vhostData = {};
 
                        var gridProperties = {
                                keepSelection: true,
@@ -232,8 +218,7 @@ define(["dojo/_base/xhr",
 
                                 }};
 
-                   that.updateHeader();
-                   that.queuesGrid = new UpdatableStore(that.vhostData.queues, findNode("queues"),
+                   that.queuesGrid = new UpdatableStore([], findNode("queues"),
                                                         [ { name: "Name",    field: "name",      width: "30%"},
                                                           { name: "Type",    field: "type",      width: "20%"},
                                                           { name: "Consumers", field: "consumerCount", width: "10%"},
@@ -262,7 +247,7 @@ define(["dojo/_base/xhr",
                                                                          });
                                                         } , gridProperties, EnhancedGrid);
 
-                   that.exchangesGrid = new UpdatableStore(that.vhostData.exchanges, findNode("exchanges"),
+                   that.exchangesGrid = new UpdatableStore([], findNode("exchanges"),
                                                            [
                                                              { name: "Name",    field: "name", width: "50%"},
                                                              { name: "Type", field: "type", width: "30%"},
@@ -280,7 +265,7 @@ define(["dojo/_base/xhr",
                                                            } , gridProperties, EnhancedGrid);
 
 
-                   that.connectionsGrid = new UpdatableStore(that.vhostData.connections,
+                   that.connectionsGrid = new UpdatableStore([],
                                                              findNode("connections"),
                                                              [ { name: "Name",    field: "name",      width: "20%"},
                                                                  { name: "User", field: "principal", width: "10%"},
@@ -307,10 +292,6 @@ define(["dojo/_base/xhr",
                                                                               });
                                                              } );
 
-
-
-               });
-
            }
 
            Updater.prototype.updateHeader = function()
@@ -331,13 +312,19 @@ define(["dojo/_base/xhr",
                             this)
            };
 
-           Updater.prototype.update = function()
+           Updater.prototype.update = function(callback)
            {
                var thisObj = this;
 
-               xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"})
+               this.management.load(this.modelObj)
                    .then(function(data) {
                        thisObj.vhostData = data[0] || {name: thisObj.virtualHost.name,statistics:{messagesIn:0,bytesIn:0,messagesOut:0,bytesOut:0}};
+
+                       if (callback)
+                       {
+                        callback();
+                       }
+
                        try
                        {
                             thisObj._update();
@@ -349,7 +336,7 @@ define(["dojo/_base/xhr",
                                 console.error(e);
                             }
                        }
-                   });
+                   }, util.xhrErrorHandler);
            }
 
            Updater.prototype._update = function()

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHostNode.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHostNode.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHostNode.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHostNode.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",
         "dojo/_base/connect",
         "dijit/registry",
@@ -33,13 +32,15 @@ define(["dojo/_base/xhr",
         "qpid/management/addExchange",
         "qpid/management/editVirtualHostNode",
         "dojox/grid/EnhancedGrid",
+        "dojo/text!showVirtualHostNode.html",
         "dojo/domReady!"],
-       function (xhr, parser, query, connect, registry, entities, properties, updater, util, formatter, UpdatableStore, addQueue, addExchange, editVirtualHostNode, EnhancedGrid) {
+       function (parser, query, connect, registry, entities, properties, updater, util, formatter, UpdatableStore, addQueue, addExchange, editVirtualHostNode, EnhancedGrid, template) {
 
            function VirtualHostNode(name, parent, controller)
            {
                this.name = name;
                this.controller = controller;
+               this.management = controller.management;
                this.modelObj = { type: "virtualhostnode", name: name, parent: parent};
            }
 
@@ -52,15 +53,11 @@ define(["dojo/_base/xhr",
            {
                var that = this;
                this.contentPane = contentPane;
-               xhr.get({url: "showVirtualHostNode.html",
-                        sync: true,
-                        load:  function(data) {
-                            contentPane.containerNode.innerHTML = data;
-                            parser.parse(contentPane.containerNode).then(function(instances)
-                            {
-                                that.onOpen(contentPane.containerNode)
-                            });
-                       }});
+               contentPane.containerNode.innerHTML = template;
+               parser.parse(contentPane.containerNode).then(function(instances)
+               {
+                   that.onOpen(contentPane.containerNode)
+               });
 
            };
 
@@ -78,10 +75,8 @@ define(["dojo/_base/xhr",
                    if (confirm("Deletion of virtual host node will delete both configuration and message data.\n\n"
                            + "Are you sure you want to delete virtual host node '" + entities.encode(String(that.name)) + "'?"))
                    {
-                     if (util.sendRequest("api/latest/virtualhostnode/" + encodeURIComponent( that.name) , "DELETE"))
-                     {
-                       that.destroy();
-                     }
+                     that.management.remove(that.modelObj).then(
+                        function(x){that.destroy();}, util.xhrErrorHandler);
                    }
                  }
              );
@@ -89,8 +84,7 @@ define(["dojo/_base/xhr",
                function(event)
                {
                  that.startNodeButton.set("disabled", true);
-                 util.sendRequest("api/latest/virtualhostnode/" + encodeURIComponent(that.name),
-                         "PUT", {desiredState: "ACTIVE"});
+                 that.management.update(that.modelObj, {desiredState: "ACTIVE"}, null, util.xhrErrorHandler);
                });
 
              this.stopNodeButton.on("click",
@@ -101,15 +95,14 @@ define(["dojo/_base/xhr",
                          + entities.encode(String(that.name)) +"'?"))
                  {
                      that.stopNodeButton.set("disabled", true);
-                     util.sendRequest("api/latest/virtualhostnode/" + encodeURIComponent(that.name),
-                             "PUT", {desiredState: "STOPPED"});
+                     that.management.update(that.modelObj, {desiredState: "STOPPED"}, null, util.xhrErrorHandler);
                  }
                });
 
                this.editNodeButton.on("click",
                 function(event)
                 {
-                    editVirtualHostNode.show(that.vhostNodeUpdater.nodeData);
+                    editVirtualHostNode.show(management, that.modelObj, that.vhostNodeUpdater.nodeData);
                 }
                );
 
@@ -128,9 +121,7 @@ define(["dojo/_base/xhr",
                     }, {height: 200, canSort : function(col) {return false;} }, EnhancedGrid);
 
              this.vhostNodeUpdater = new Updater(containerNode, this.modelObj, this);
-             this.vhostNodeUpdater.update();
-
-             updater.add( this.vhostNodeUpdater );
+             this.vhostNodeUpdater.update(function(x){updater.add( that.vhostNodeUpdater );});
            }
 
            VirtualHostNode.prototype.showVirtualHost=function(item)
@@ -154,6 +145,7 @@ define(["dojo/_base/xhr",
            function Updater(domNode, nodeObject, virtualHostNode)
            {
                this.virtualHostNode = virtualHostNode;
+               this.modelObj = nodeObject;
                var that = this;
 
                function findNode(name)
@@ -171,20 +163,22 @@ define(["dojo/_base/xhr",
 
                storeNodes(["name", "state", "type"]);
                this.detailsDiv = findNode("virtualhostnodedetails");
-
-               this.query = "api/latest/virtualhostnode/" + encodeURIComponent(nodeObject.name);
           }
 
-           Updater.prototype.update = function()
+           Updater.prototype.update = function(callback)
            {
                var that = this;
-               xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}).then(
+               that.virtualHostNode.management.load(this.modelObj).then(
                    function(data)
                    {
-                     that.nodeData = data[0];
-                     that.updateUI(data[0]);
-                   }
-               );
+                     that.nodeData = data[0] || {};
+                     that.updateUI(that.nodeData);
+
+                     if (callback)
+                     {
+                        callback();
+                     }
+                   });
            };
 
            Updater.prototype.updateUI = function(data)

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/accesscontrolprovider/AclFile.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/accesscontrolprovider/AclFile.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/accesscontrolprovider/AclFile.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/accesscontrolprovider/AclFile.js Mon May  4 12:17:23 2015
@@ -47,6 +47,7 @@ define(["dojo/_base/xhr",
     function (xhr, dom, parser, query, construct, connect, win, event, json, registry, entities, util, properties, updater, UpdatableStore, EnhancedGrid) {
         function AclFile(containerNode, aclProviderObj, controller) {
             var node = construct.create("div", null, containerNode, "last");
+            this.modelObj = aclProviderObj;
             var that = this;
             this.name = aclProviderObj.name;
             xhr.get({url: "accesscontrolprovider/showAclFile.html",
@@ -72,7 +73,8 @@ define(["dojo/_base/xhr",
         function AclFileUpdater(node, aclProviderObj, controller)
         {
             this.controller = controller;
-            this.query = "api/latest/accesscontrolprovider/"+encodeURIComponent(aclProviderObj.name);
+            this.modelObj = aclProviderObj;
+            this.management = controller.management;
             this.name = aclProviderObj.name;
             this.path = query(".path", node)[0];
         }
@@ -81,14 +83,15 @@ define(["dojo/_base/xhr",
         {
             var that = this;
 
-            xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"})
+            this.management.load(this.modelObj)
                 .then(function(data) {
                   if (data[0])
                   {
                     that.aclProviderData = data[0];
                     that.path.innerHTML = entities.encode(String(that.aclProviderData.path));
                   }
-                });
+                },
+                util.xhrErrorHandler);
 
         };
 

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAccessControlProvider.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAccessControlProvider.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAccessControlProvider.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAccessControlProvider.js Mon May  4 12:17:23 2015
@@ -19,7 +19,6 @@
  *
  */
 define(["dojo/_base/lang",
-        "dojo/_base/xhr",
         "dojo/dom",
         "dojo/dom-construct",
         "dijit/registry",
@@ -28,7 +27,6 @@ define(["dojo/_base/lang",
         "dojo/_base/event",
         'dojo/json',
         "qpid/common/util",
-        "qpid/common/metadata",
         "dojo/text!addAccessControlProvider.html",
         "dojo/store/Memory",
         "dojox/validate/us",
@@ -44,7 +42,7 @@ define(["dojo/_base/lang",
         "dijit/layout/ContentPane",
         "dojox/layout/TableContainer",
         "dojo/domReady!"],
-    function (lang, xhr, dom, construct, registry, parser, array, event, json, util, metadata, template)
+    function (lang, dom, construct, registry, parser, array, event, json, util, template)
     {
 
         var addAccessControlProvider =
@@ -70,15 +68,17 @@ define(["dojo/_base/lang",
                 this.accessControlProviderTypeFieldsContainer = dom.byId("addAccessControlProvider.typeFields");
                 this.accessControlProviderForm = registry.byId("addAccessControlProvider.form");
                 this.accessControlProviderType = registry.byId("addAccessControlProvider.type");
-                this.supportedAccessControlProviderTypes = metadata.getTypesForCategory("AccessControlProvider");
-                this.supportedAccessControlProviderTypes.sort();
-                var accessControlProviderTypeStore = util.makeTypeStore(this.supportedAccessControlProviderTypes);
-                this.accessControlProviderType.set("store", accessControlProviderTypeStore);
                 this.accessControlProviderType.on("change", function(type){that._accessControlProviderTypeChanged(type);});
             },
-            show: function(effectiveData)
+            show: function(management, modelObj, effectiveData)
             {
+                this.management = management;
+                this.modelObj = modelObj;
                 this.accessControlProviderForm.reset();
+                this.supportedAccessControlProviderTypes = management.metadata.getTypesForCategory("AccessControlProvider");
+                this.supportedAccessControlProviderTypes.sort();
+                var accessControlProviderTypeStore = util.makeTypeStore(this.supportedAccessControlProviderTypes);
+                this.accessControlProviderType.set("store", accessControlProviderTypeStore);
                 this.dialog.show();
             },
             _cancel: function(e)
@@ -101,7 +101,7 @@ define(["dojo/_base/lang",
                 {
                     var accessControlProviderData = util.getFormWidgetValues(this.accessControlProviderForm, this.initialData);
                     var that = this;
-                    util.post("api/latest/accesscontrolprovider", accessControlProviderData, function(x){that.dialog.hide();});
+                    this.management.create("accesscontrolprovider", this.modelObj, accessControlProviderData, function(x){that.dialog.hide();}, util.xhrErrorHandler);
                 }
                 else
                 {
@@ -126,7 +126,7 @@ define(["dojo/_base/lang",
                          try
                          {
                              typeUI.show({containerNode:typeFieldsContainer, parent: that, data: that.initialData, effectiveData: that.effectiveData});
-                             util.applyMetadataToWidgets(typeFieldsContainer, category, type);
+                             util.applyMetadataToWidgets(typeFieldsContainer, category, type, that.management.metadata);
                          }
                          catch(e)
                          {

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAuthenticationProvider.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAuthenticationProvider.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAuthenticationProvider.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAuthenticationProvider.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",
@@ -32,7 +31,6 @@ define(["dojo/_base/xhr",
         "dojo/_base/connect",
         "dojo/dom-style",
         "qpid/common/util",
-        "qpid/common/metadata",
         "dojo/text!addAuthenticationProvider.html",
         "qpid/management/preferencesprovider/PreferencesProviderForm",
         /* dojox/ validate resources */
@@ -48,7 +46,7 @@ define(["dojo/_base/xhr",
         "dojox/form/BusyButton", "dojox/form/CheckedMultiSelect",
         "dojox/layout/TableContainer",
         "dojo/domReady!"],
-    function (xhr, dom, construct, win, registry, parser, array, event, json, Memory, FilteringSelect, connect, domStyle, util, metadata, template)
+    function (dom, construct, win, registry, parser, array, event, json, Memory, FilteringSelect, connect, domStyle, util, template)
     {
         var addAuthenticationProvider =
         {
@@ -74,51 +72,49 @@ define(["dojo/_base/xhr",
                 this.authenticationProviderTypeFieldsContainer = dom.byId("addAuthenticationProvider.typeFields");
                 this.authenticationProviderForm = registry.byId("addAuthenticationProvider.form");
                 this.authenticationProviderType = registry.byId("addAuthenticationProvider.type");
-                this.supportedAuthenticationProviderTypes = metadata.getTypesForCategory("AuthenticationProvider");
-                this.supportedAuthenticationProviderTypes.sort();
-                var authenticationProviderTypeStore = util.makeTypeStore(this.supportedAuthenticationProviderTypes);
-                this.authenticationProviderType.set("store", authenticationProviderTypeStore);
                 this.authenticationProviderType.on("change", function(type){that._authenticationProviderTypeChanged(type);});
 
                 this.preferencesProviderForm = new qpid.preferencesprovider.PreferencesProviderForm({disabled: true});
                 this.preferencesProviderForm.placeAt(dom.byId("addPreferencesProvider.form"));
             },
-            show:function(effectiveData)
+            show:function(management, modelObj, effectiveData)
             {
+                this.management = management;
+                this.modelObj = modelObj;
                 this.authenticationProviderForm.reset();
+                this.preferencesProviderForm.setMetadata(management.metadata);
+
+                this.supportedAuthenticationProviderTypes = management.metadata.getTypesForCategory("AuthenticationProvider");
+                this.supportedAuthenticationProviderTypes.sort();
+                var authenticationProviderTypeStore = util.makeTypeStore(this.supportedAuthenticationProviderTypes);
+                this.authenticationProviderType.set("store", authenticationProviderTypeStore);
 
                 if (effectiveData)
                 {
                     // editing
-                    var actualData = null;
-                    xhr.get(
-                                {
-                                  url: "api/latest/authenticationprovider/" + encodeURIComponent(effectiveData.name),
-                                  sync: true,
-                                  content: { actuals: true },
-                                  handleAs: "json",
-                                  load: function(data)
+                    var that = this;
+                    management.load(modelObj, { actuals: true },
+                                  function(data)
                                   {
-                                    actualData = data[0];
-                                  }
-                                }
-                            );
-                    this.initialData = actualData;
-                    this.effectiveData = effectiveData;
-                    this.authenticationProviderType.set("value", actualData.type);
-
-                    this.authenticationProviderType.set("disabled", true);
-                    this.authenticationProviderName.set("disabled", true);
-                    if (actualData.preferencesproviders && actualData.preferencesproviders[0])
-                    {
-                        this.preferencesProviderForm.setData(actualData.preferencesproviders[0]);
-                    }
-                    else
-                    {
-                        this.preferencesProviderForm.reset();
-                        this.preferencesProviderForm.preferencesProviderNameWidget.set("value", actualData.name);
-                    }
-                    this.authenticationProviderName.set("value", actualData.name);
+                                    var actualData = data[0];
+                                    that.initialData = actualData;
+                                    that.effectiveData = effectiveData;
+                                    that.authenticationProviderType.set("value", actualData.type);
+
+                                    that.authenticationProviderType.set("disabled", true);
+                                    that.authenticationProviderName.set("disabled", true);
+                                    if (actualData.preferencesproviders && actualData.preferencesproviders[0])
+                                    {
+                                        that.preferencesProviderForm.setData(actualData.preferencesproviders[0]);
+                                    }
+                                    else
+                                    {
+                                        that.preferencesProviderForm.reset();
+                                        that.preferencesProviderForm.preferencesProviderNameWidget.set("value", actualData.name);
+                                    }
+                                    that.authenticationProviderName.set("value", actualData.name);
+                                    that._show();
+                                  }, util.xhrErrorHandler );
                 }
                 else
                 {
@@ -127,8 +123,11 @@ define(["dojo/_base/xhr",
                     this.authenticationProviderName.set("disabled", false);
                     this.initialData = {};
                     this.effectiveData = {};
+                    this._show();
                 }
-
+            },
+            _show: function()
+            {
                 this.dialog.show();
                 if (!this.resizeEventRegistered)
                 {
@@ -153,25 +152,48 @@ define(["dojo/_base/xhr",
                     var authenticationProviderData = util.getFormWidgetValues(this.authenticationProviderForm, this.initialData);
 
                     var that = this;
-                    var encodedAuthenticationProviderName = encodeURIComponent(this.authenticationProviderName.value);
-                    var url = "api/latest/authenticationprovider";
+
+                    var hideDialog = function(x)
+                    {
+                        that.dialog.hide();
+                    }
+
+                    var savePreferences = function(x)
+                    {
+                        that.preferencesProviderForm.submit(
+                            function(preferencesProviderData)
+                            {
+                                if (that.preferencesProviderForm.data)
+                                {
+                                    // update request
+                                    var name = that.preferencesProviderForm.getPreferencesProviderName();
+
+                                    var modelObj = {name: name, type: "preferencesprovider",  parent: that.modelObj};
+                                    that.management.update(modelObj, preferencesProviderData, hideDialog, util.xhrErrorHandler);
+                                }
+                                else
+                                {
+                                    var authProviderModelObj = that.modelObj;
+                                    if (authProviderModelObj.type != "authenticationprovider")
+                                    {
+                                        authProviderModelObj = { name: authenticationProviderData.name, type: "authenticationprovider", parent: that.modelObj};
+                                    }
+                                    that.management.create("preferencesprovider", authProviderModelObj, preferencesProviderData, hideDialog, util.xhrErrorHandler);
+                                }
+                            },
+                            hideDialog
+                        );
+                    }
+
                     if (this.initialData && this.initialData.id)
                     {
                         // update request
-                        url += "/" + encodedAuthenticationProviderName;
+                        this.management.update(that.modelObj, authenticationProviderData, savePreferences);
+                    }
+                    else
+                    {
+                        this.management.create("authenticationprovider", that.modelObj, authenticationProviderData, savePreferences);
                     }
-                    util.post(url, authenticationProviderData,
-                     function(x){
-                        var preferencesProviderResult = that.preferencesProviderForm.submit(encodedAuthenticationProviderName);
-                        if (preferencesProviderResult.success == true)
-                        {
-                            that.dialog.hide();
-                        }
-                        else
-                        {
-                             util.xhrErrorHandler(preferencesProviderResult.failureReason);
-                        }
-                     });
                 }
                 else
                 {
@@ -187,7 +209,12 @@ define(["dojo/_base/xhr",
                 var widgets = registry.findWidgets(typeFieldsContainer);
                 array.forEach(widgets, function(item) { item.destroyRecursive();});
                 construct.empty(typeFieldsContainer);
-                this.preferencesProviderForm.set("disabled", !type || !util.supportsPreferencesProvider(type));
+                var supportsPreferencesProvider = false;
+                if (type && this.management)
+                {
+                    supportsPreferencesProvider = this.management.metadata.implementsManagedInterface("AuthenticationProvider", type, "PreferencesSupportingAuthenticationProvider");
+                }
+                this.preferencesProviderForm.set("disabled", !type || !supportsPreferencesProvider);
                 if (type)
                 {
                     var that = this;
@@ -196,7 +223,7 @@ define(["dojo/_base/xhr",
                         try
                         {
                             typeUI.show({containerNode:typeFieldsContainer, parent: that, data: that.initialData, effectiveData: that.effectiveData});
-                            util.applyMetadataToWidgets(typeFieldsContainer, category, type);
+                            util.applyMetadataToWidgets(typeFieldsContainer, category, type, that.management.metadata);
                         }
                         catch(e)
                         {

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addBinding.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addBinding.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addBinding.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addBinding.js Mon May  4 12:17:23 2015
@@ -15,7 +15,6 @@
  * limitations under the License.
  */
 define(["dojo/_base/connect",
-        "dojo/_base/xhr",
         "dojo/dom",
         "dojo/dom-construct",
         "dojo/_base/window",
@@ -29,6 +28,7 @@ define(["dojo/_base/connect",
         "dojo/store/Memory",
         "dijit/form/FilteringSelect",
         "qpid/common/util",
+        "dojo/text!addBinding.html",
         "dijit/form/NumberSpinner", // required by the form
         /* dojox/ validate resources */
         "dojox/validate/us", "dojox/validate/web",
@@ -45,7 +45,7 @@ define(["dojo/_base/connect",
         "dojox/grid/EnhancedGrid",
         "dojo/data/ObjectStore",
         "dojo/domReady!"],
-    function (connect, xhr, dom, construct, win, registry, parser, array, event, json, lang, declare, Memory, FilteringSelect, util) {
+    function (connect, dom, construct, win, registry, parser, array, event, json, lang, declare, Memory, FilteringSelect, util, template) {
 
         var noLocalValues = new Memory({
             data: [
@@ -171,11 +171,8 @@ define(["dojo/_base/connect",
             };
 
 
-        xhr.get({url: "addBinding.html",
-                 sync: true,
-                 load:  function(data) {
                             var theForm;
-                            node.innerHTML = data;
+                            node.innerHTML = template;
                             addBinding.dialogNode = dom.byId("addBinding");
                             parser.instantiate([addBinding.dialogNode]);
 
@@ -306,13 +303,24 @@ define(["dojo/_base/connect",
                                 event.stop(e);
                                 if(theForm.validate()){
 
-                                    var newBinding = convertToBinding(theForm.getValues());
+                                    var newBinding = convertToBinding(util.getFormWidgetValues(registry.byId("formAddBinding")));
                                     var that = this;
-                                    var url = "api/latest/binding/"+encodeURIComponent(addBinding.vhostnode)
-                                            + "/"+encodeURIComponent(addBinding.vhost)
-                                            + "/"+encodeURIComponent(newBinding.exchange)
-                                            + "/"+encodeURIComponent(newBinding.queue);
-                                    util.post(url, newBinding, function(x){registry.byId("addBinding").hide();});
+                                    var model = null;
+                                    if (addBinding.modelObj.type == "exchange")
+                                    {
+                                        model = {name: newBinding.queue, type: "queue", parent: addBinding.modelObj};
+                                    }
+                                    else
+                                    {
+                                       model = {name: newBinding.queue,
+                                                type: "queue",
+                                                parent: { name: newBinding.exchange,
+                                                          type: "exchange",
+                                                          parent: addBinding.modelObj.parent
+                                                        }
+                                                };
+                                    }
+                                    addBinding.management.create("binding", model, newBinding, function(x){registry.byId("addBinding").hide();});
                                     return false;
                                 }else{
                                     alert('Form contains invalid data.  Please correct first');
@@ -320,15 +328,11 @@ define(["dojo/_base/connect",
                                 }
 
                             });
-                        }});
 
-        addBinding.show = function(obj) {
+        addBinding.show = function(management, obj) {
             var that = this;
-
-            addBinding.vhostnode = obj.virtualhostnode;
-            addBinding.vhost = obj.virtualhost;
-            addBinding.queue = obj.queue;
-            addBinding.exchange = obj.exchange;
+            addBinding.management = management;
+            addBinding.modelObj = obj;
             registry.byId("formAddBinding").reset();
 
             var grid = addBinding.bindingArgumentsGrid;
@@ -350,8 +354,7 @@ define(["dojo/_base/connect",
             array.forEach(lang.clone(defaultBindingArguments), function(item) {grid.store.newItem(item); });
             grid.store.save();
 
-            xhr.get({url: "api/latest/queue/" + encodeURIComponent(obj.virtualhostnode) + "/" + encodeURIComponent(obj.virtualhost) + "?depth=0",
-                     handleAs: "json"}).then(
+            management.load({type: "queue", parent: obj.parent }, {depth: 0}).then(
                 function(data) {
                     var queues =  [];
                     for(var i=0; i < data.length; i++) {
@@ -373,14 +376,12 @@ define(["dojo/_base/connect",
                                                               promptMessage: "Name of the queue",
                                                               title: "Select the name of the queue"}, input);
 
-                    if(obj.queue)
+                    if(obj.type == "queue")
                     {
-                        that.queueChooser.set("value", obj.queue);
+                        that.queueChooser.set("value", obj.name);
                         that.queueChooser.set("disabled", true);
                     }
-
-                    xhr.get({url: "api/latest/exchange/" + encodeURIComponent(obj.virtualhostnode) + "/" + encodeURIComponent(obj.virtualhost) + "?depth=0",
-                                         handleAs: "json"}).then(
+                    management.load({type: "exchange", parent: obj.parent }, {depth: 0}).then(
                         function(data) {
 
                             var exchanges =  [];
@@ -403,18 +404,18 @@ define(["dojo/_base/connect",
                                                                       promptMessage: "Name of the exchange",
                                                                       title: "Select the name of the exchange"}, input);
 
-                            if(obj.exchange)
+                            if(obj.type == "exchange")
                             {
-                                that.exchangeChooser.set("value", obj.exchange);
+                                that.exchangeChooser.set("value", obj.name);
                                 that.exchangeChooser.set("disabled", true);
                             }
 
 
                             registry.byId("addBinding").show();
-                        });
+                        }, util.xhrErrorHandler);
 
 
-                });
+                }, util.xhrErrorHandler);
 
 
         };

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addExchange.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addExchange.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addExchange.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addExchange.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!addExchange.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 addExchange = {};
 
@@ -74,11 +74,9 @@ define(["dojo/_base/xhr",
             };
 
 
-        xhr.get({url: "addExchange.html",
-                 sync: true,
-                 load:  function(data) {
+
                             var theForm;
-                            node.innerHTML = data;
+                            node.innerHTML = template;
                             addExchange.dialogNode = dom.byId("addExchange");
                             parser.instantiate([addExchange.dialogNode]);
 
@@ -110,8 +108,7 @@ define(["dojo/_base/xhr",
 
                                     var newExchange = convertToExchange(theForm.getValues());
                                     var that = this;
-                                    util.post("api/latest/exchange/" + encodeURIComponent(addExchange.vhostnode)
-                                            + "/" + encodeURIComponent(addExchange.vhost),
+                                    addExchange.management.create("exchange", addExchange.modelObj,
                                             newExchange, function(x){ registry.byId("addExchange").hide(); });
                                     return false;
 
@@ -122,11 +119,10 @@ define(["dojo/_base/xhr",
                                 }
 
                             });
-                        }});
 
-        addExchange.show = function(data) {
-                            addExchange.vhost = data.virtualhost;
-                            addExchange.vhostnode = data.virtualhostnode;
+        addExchange.show = function(management, modelObj) {
+                            addExchange.management = management
+                            addExchange.modelObj = modelObj;
                             registry.byId("formAddExchange").reset();
                             registry.byId("addExchange").show();
                         };

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addGroupProvider.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addGroupProvider.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addGroupProvider.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addGroupProvider.js Mon May  4 12:17:23 2015
@@ -19,7 +19,6 @@
  *
  */
 define([
-        "dojo/_base/xhr",
         "dojo/dom",
         "dojo/dom-construct",
         "dijit/registry",
@@ -28,7 +27,6 @@ define([
         "dojo/_base/event",
         'dojo/json',
         "qpid/common/util",
-        "qpid/common/metadata",
         "dojo/text!addGroupProvider.html",
         "dojo/store/Memory",
         "dojox/validate/us",
@@ -44,7 +42,7 @@ define([
         "dijit/layout/ContentPane",
         "dojox/layout/TableContainer",
         "dojo/domReady!"],
-    function (xhr, dom, construct, registry, parser, array, event, json, util, metadata, template)
+    function (dom, construct, registry, parser, array, event, json, util, template)
     {
 
         var addGroupProvider =
@@ -72,14 +70,11 @@ define([
 
                 this.groupProviderType = registry.byId("addGroupProvider.type");
                 this.groupProviderType.on("change", function(type){that._groupProviderTypeChanged(type);});
-
-                var supportedTypes = metadata.getTypesForCategory("GroupProvider");
-                supportedTypes.sort();
-                var supportedTypesStore = util.makeTypeStore(supportedTypes);
-                this.groupProviderType.set("store", supportedTypesStore);
             },
-            show: function(actualData)
+            show: function(management, modelObj, actualData)
             {
+                this.management = management;
+                this.modelObj = modelObj;
                 this.initialData = actualData;
                 this.groupProviderForm.reset();
 
@@ -90,13 +85,17 @@ define([
                 }
                 this.groupProviderName.set("disabled", actualData == null ? false : true);
                 this.groupProviderType.set("disabled", actualData == null ? false : true);
-                this.dialog.set("title", actualData == null ? "Add Group Provider" : "Edit Group Provider - " + actualData.name)
+                this.dialog.set("title", actualData == null ? "Add Group Provider" : "Edit Group Provider - " + actualData.name);
+                var supportedTypes = management.metadata.getTypesForCategory("GroupProvider");
+                supportedTypes.sort();
+                var supportedTypesStore = util.makeTypeStore(supportedTypes);
+                this.groupProviderType.set("store", supportedTypesStore);
                 this.dialog.show();
             },
             _initFields:function(data)
             {
                 var type = data["type"];
-                var attributes = metadata.getMetaData("GroupProvider", type).attributes;
+                var attributes = this.management.metadata.getMetaData("GroupProvider", type).attributes;
                 for(var name in attributes)
                 {
                     var widget = registry.byId("addGroupProvider."+name);
@@ -123,14 +122,16 @@ define([
                     var groupProviderData = util.getFormWidgetValues(this.groupProviderForm, this.initialData);
 
                     var that = this;
-                    var url = "api/latest/groupprovider";
+
                     if (this.initialData)
                     {
                         // update request
-                        url += "/" +  encodeURIComponent(this.groupProviderName.value)
+                        this.management.update(this.modelObj, groupProviderData, function(x){that.dialog.hide();});
+                    }
+                    else
+                    {
+                        this.management.create("groupprovider", this.modelObj,groupProviderData, function(x){that.dialog.hide();});
                     }
-
-                    util.post( url,groupProviderData, function(x){that.dialog.hide();});
                 }
                 else
                 {
@@ -148,7 +149,7 @@ define([
                          try
                          {
                              typeUI.show({containerNode: that.groupProviderTypeFieldsContainer, parent: that, data: that.initialData});
-                             util.applyMetadataToWidgets(that.groupProviderTypeFieldsContainer, "GroupProvider", type);
+                             util.applyMetadataToWidgets(that.groupProviderTypeFieldsContainer, "GroupProvider", type, that.management.metadata);
                          }
                          catch(e)
                          {

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPort.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPort.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPort.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPort.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",
@@ -32,7 +31,7 @@ define(["dojo/_base/xhr",
         "dojo/dom-style",
         "dojo/_base/lang",
         "qpid/common/util",
-        "qpid/common/metadata",
+        "dojo/text!addPort.html",
         /* dojox/ validate resources */
         "dojox/validate/us",
         "dojox/validate/web",
@@ -55,20 +54,24 @@ define(["dojo/_base/xhr",
         "dojox/grid/EnhancedGrid",
         "dojox/grid/enhanced/plugins/IndirectSelection",
         "dojo/domReady!"],
-    function (xhr, dom, construct, win, registry, array, event, json, Memory, ObjectStore, FilteringSelect, domStyle, lang, util, metadata) {
+    function (dom, construct, win, registry, array, event, json, Memory, ObjectStore, FilteringSelect, domStyle, lang, util, template) {
 
         var addPort = {};
 
         var node = construct.create("div", null, win.body(), "last");
 
+        node.innerHTML = template;
+        addPort.dialogNode = dom.byId("addPort")
+
         addPort._typeChanged = function (newValue)
         {
-            var typeMetaData = metadata.getMetaData("Port", newValue);
+            var meta =  addPort.management.metadata;
+            var typeMetaData = meta.getMetaData("Port", newValue);
 
             //protocols
             var protocolsMultiSelect = dom.byId("formAddPort.protocols");
             var protocolValidValues = typeMetaData.attributes.protocols.validValues;
-            var protocolValues = metadata.extractUniqueListOfValues(protocolValidValues);
+            var protocolValues = meta.extractUniqueListOfValues(protocolValidValues);
             util.setMultiSelectOptions(protocolsMultiSelect, protocolValues.sort());
 
             //authenticationProvider
@@ -86,12 +89,12 @@ define(["dojo/_base/xhr",
             //transports
             var transportsMultiSelect = dom.byId("formAddPort.transports");
             var transportsValidValues = typeMetaData.attributes.transports.validValues;
-            var transportsValues = metadata.extractUniqueListOfValues(transportsValidValues);
+            var transportsValues = meta.extractUniqueListOfValues(transportsValidValues);
             util.setMultiSelectOptions(transportsMultiSelect, transportsValues.sort());
 
             addPort._toggleSslWidgets(newValue, transportsMultiSelect.value);
-            util.applyMetadataToWidgets(registry.byId("addPort").domNode, "Port", newValue);
 
+            util.applyMetadataToWidgets(registry.byId("addPort").domNode, "Port", newValue, meta);
         };
 
         addPort._isSecure = function(currentTransport)
@@ -203,6 +206,7 @@ define(["dojo/_base/xhr",
 
                 if (addPort._isSecure(transportType))
                 {
+                    var metadata =  addPort.management.metadata;
                     var typeMetaData = metadata.getMetaData("Port", portType);
                     var clientAuth = "needClientAuth" in typeMetaData.attributes || "wantClientAuth" in typeMetaData.attributes;
                     clientAuthPanel.style.display = clientAuth ? "block" : "none";
@@ -228,17 +232,7 @@ define(["dojo/_base/xhr",
 
             };
 
-        addPort._init = function()
-        {
-          xhr.get({url: "addPort.html", sync: true, load: function (data)
-          {
-            var theForm;
-            node.innerHTML = data;
-            addPort.dialogNode = dom.byId("addPort");
-          }});
-        }
-
-        addPort._prepareForm = function()
+        addPort._prepareForm = function(metadata)
         {
           //add the port types to formAddPort.type
           var portTypeSelect = registry.byId("formAddPort.type");
@@ -253,7 +247,8 @@ define(["dojo/_base/xhr",
             addPort._toggleSslWidgets(portType, newValue);
           });
 
-          theForm = registry.byId("formAddPort");
+          var that = this;
+          var theForm = registry.byId("formAddPort");
           theForm.on("submit", function (e)
           {
 
@@ -267,13 +262,15 @@ define(["dojo/_base/xhr",
                 alert("A trust store must be selected when requesting client certificates.");
                 return false;
               }
-              var url = "api/latest/port";
               if (registry.byId("formAddPort.name").get("disabled"))
               {
                 // update request
-                url += "/" + encodeURIComponent(newPort.name);
+                addPort.management.update(addPort.modelObj,newPort, function(x){registry.byId("addPort").hide()}, util.xhrErrorHandler);
+              }
+              else
+              {
+                addPort.management.create("port", addPort.modelObj ,newPort, function(x){registry.byId("addPort").hide()}, util.xhrErrorHandler);
               }
-              util.post(url, newPort, function(x){registry.byId("addPort").hide()});
               return false;
             } else
             {
@@ -284,12 +281,14 @@ define(["dojo/_base/xhr",
           });
         }
 
-        addPort.show = function(portName, portType, providers, keystores, truststores)
+        addPort.show = function(management, modelObj, portType, providers, keystores, truststores)
         {
-
+            addPort.management = management;
+            addPort.modelObj = modelObj;
+            var metadata = management.metadata;
             if (!this.formPrepared)
             {
-              this._prepareForm();
+              this._prepareForm(metadata);
               this.formPrepared = true;
             }
 
@@ -351,15 +350,11 @@ define(["dojo/_base/xhr",
                 this.typeChangeHandler.remove();
             }
 
-            if (portName)
+            if (modelObj.type == "port")
             {
                 editWarning.style.display = "block";
 
-                xhr.get({
-                    url: "api/latest/port/" + encodeURIComponent(portName),
-                    content: { actuals: true },
-                    handleAs: "json"
-                }).then(
+                management.load(modelObj, { actuals: true }).then(
                    function(data){
                        var port = data[0];
                        nameWidget.set("value", port.name);
@@ -443,8 +438,8 @@ define(["dojo/_base/xhr",
                        maxOpenConnectionsWidget.initialValue = maxOpenConnectionsWidget.value;
 
                        registry.byId("addPort").show();
-                       util.applyMetadataToWidgets(registry.byId("addPort").domNode, "Port", portType);
-                   });
+                       util.applyMetadataToWidgets(registry.byId("addPort").domNode, "Port", portType, management.metadata);
+                   }, util.xhrErrorHandler);
             }
             else
             {
@@ -465,12 +460,10 @@ define(["dojo/_base/xhr",
                 editWarning.style.display = "none";
                 registry.byId("addPort").show();
 
-                util.applyMetadataToWidgets(registry.byId("addPort").domNode, "Port", portType);
+                util.applyMetadataToWidgets(registry.byId("addPort").domNode, "Port", portType, management.metadata);
             }
 
         };
 
-        addPort._init();
-
         return addPort;
     });

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPreferencesProvider.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPreferencesProvider.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPreferencesProvider.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPreferencesProvider.js Mon May  4 12:17:23 2015
@@ -54,30 +54,47 @@ define([
                 var saveButton = registry.byId("addPreferencesProvider.saveButton");
                 saveButton.on("click", function()
                 {
-                    var result = that.preferencesProviderForm.submit(encodeURIComponent(addPreferencesProvider.authenticationProviderName));
-                    if (result.success)
-                    {
-                        that.dialog.hide();
-                    }
-                    else
-                    {
-                        util.xhrErrorHandler(result.failureReason);
-                    }
+                    var result = that.preferencesProviderForm.submit(
+                                            function(preferencesProviderData){
+                                                if (that.preferencesProviderForm.data)
+                                                {
+                                                    // update request
+                                                    that.management.update(that.modelObj, preferencesProviderData, function(){that.dialog.hide();}, util.xhrErrorHandler);
+                                                }
+                                                else
+                                                {
+                                                    that.management.create("preferencesprovider",that.modelObj, preferencesProviderData, function(){that.dialog.hide();}, util.xhrErrorHandler);
+                                                }
+                                            });
                 });
             },
-            show: function(authenticationProviderName, providerName)
+            show: function(management, modelObj)
             {
-                this.authenticationProviderName = authenticationProviderName;
-                this.dialog.set("title", (providerName ? "Edit preferences provider '" + entities.encode(String(providerName)) + "' " : "Add preferences provider ") + " for '" + entities.encode(String(authenticationProviderName)) + "' ");
-                if (providerName)
+                this.management = management;
+                this.modelObj = modelObj;
+                this.preferencesProviderForm.setMetadata(management.metadata)
+                this.authenticationProviderName = modelObj.type == "authenticationprovider" ? modelObj.name : modelObj.parent.name;
+                this.dialog.set("title", modelObj.type == "preferencesprovider" ?
+                                        "Edit preferences provider '" + entities.encode(String(modelObj.name))
+                                            + "' for '" + entities.encode(String(modelObj.parent.name)) + "'":
+                                        "Add preferences provider " + " for '" + entities.encode(String(modelObj.name)) );
+                if (modelObj.type == "preferencesprovider")
                 {
-                    this.preferencesProviderForm.load(authenticationProviderName, providerName);
+                    var that = this;
+                    management.load(modelObj, {actuals: true}).then(
+                        function(data)
+                        {
+                            that.preferencesProviderForm.setData(data[0]);
+                            that.dialog.show();
+                        },
+                        util.xhrErrorHandler
+                    );
                 }
                 else
                 {
                     this.preferencesProviderForm.reset();
+                    this.dialog.show();
                 }
-                this.dialog.show();
             }
         };
 

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addQueue.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addQueue.js?rev=1677590&r1=1677589&r2=1677590&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addQueue.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addQueue.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",
@@ -29,6 +28,7 @@ define(["dojo/_base/xhr",
         'dojo/_base/json',
         "dojo/query",
         'qpid/common/util',
+        "dojo/text!addQueue.html",
         "qpid/common/ContextVariablesEditor",
         "dijit/form/NumberSpinner", // required by the form
         /* dojox/ validate resources */
@@ -44,7 +44,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, query, util) {
+    function (dom, construct, win, registry, parser, array, event, json, query, util, template) {
 
         var addQueue = {};
 
@@ -111,11 +111,8 @@ define(["dojo/_base/xhr",
             };
 
 
-        xhr.get({url: "addQueue.html",
-                 sync: true,
-                 load:  function(data) {
                             var theForm;
-                            node.innerHTML = data;
+                            node.innerHTML = template;
                             addQueue.dialogNode = dom.byId("addQueue");
                             parser.instantiate([addQueue.dialogNode]);
 
@@ -130,7 +127,10 @@ define(["dojo/_base/xhr",
                                     if (node.id === "formAddQueueType:" + value)
                                     {
                                         node.style.display = "block";
-                                        util.applyMetadataToWidgets(node, "Queue", value);
+                                        if (addQueue.management)
+                                        {
+                                            util.applyMetadataToWidgets(node, "Queue", value, addQueue.management.metadata);
+                                        }
                                     }
                                     else
                                     {
@@ -149,8 +149,7 @@ define(["dojo/_base/xhr",
                                 if(theForm.validate()){
 
                                     var newQueue = convertToQueue(theForm.getValues());
-                                    util.post("api/latest/queue/" + encodeURIComponent(addQueue.vhostnode)
-                                            + "/"+encodeURIComponent(addQueue.vhost),
+                                    addQueue.management.create("queue", addQueue.modelObj,
                                             newQueue, function(x){registry.byId("addQueue").hide();});
                                     return false;
 
@@ -161,15 +160,14 @@ define(["dojo/_base/xhr",
                                 }
 
                             });
-                        }});
 
-        addQueue.show = function(data) {
-                            addQueue.vhost = data.virtualhost;
-                            addQueue.vhostnode = data.virtualhostnode;
+        addQueue.show = function(management, modelObj) {
+                            addQueue.management = management;
+                            addQueue.modelObj = modelObj;
                             var form = registry.byId("formAddQueue");
                             form.reset();
                             registry.byId("addQueue").show();
-                            util.applyMetadataToWidgets(form.domNode, "Queue", "standard");
+                            util.applyMetadataToWidgets(form.domNode, "Queue", "standard", addQueue.management.metadata);
 
                             if (!this.context)
                             {
@@ -177,8 +175,12 @@ define(["dojo/_base/xhr",
                              this.context.placeAt(dom.byId("formAddQueue.context"));
                             }
 
-                            var escapedUrl = "api/latest/virtualhost/" + encodeURIComponent(addQueue.vhostnode) + "/" + encodeURIComponent(addQueue.vhost);
-                            this.context.loadInheritedData(escapedUrl);
+                            management.load(modelObj).then(
+                                          function(effectiveData)
+                                          {
+                                            util.setContextData(addQueue.context, management, modelObj, {}, effectiveData[0]);
+                                          },
+                                          util.xhrErrorHandler);
         };
 
         return addQueue;



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


Mime
View raw message