You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2014/08/25 17:35:12 UTC

svn commit: r1620350 [3/4] - in /qpid/branches/0.30/qpid/java: ./ bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/ bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/ bdbstore/src/test/java/org/apache/qpid/server/vi...

Modified: qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPort.js
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPort.js?rev=1620350&r1=1620349&r2=1620350&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPort.js (original)
+++ qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPort.js Mon Aug 25 15:35:10 2014
@@ -33,6 +33,7 @@ define(["dojo/_base/xhr",
         "dojo/dom-style",
         "dojo/_base/lang",
         "qpid/common/util",
+        "qpid/common/metadata",
         /* dojox/ validate resources */
         "dojox/validate/us",
         "dojox/validate/web",
@@ -55,12 +56,39 @@ define(["dojo/_base/xhr",
         "dojox/grid/EnhancedGrid",
         "dojox/grid/enhanced/plugins/IndirectSelection",
         "dojo/domReady!"],
-    function (xhr, dom, construct, win, registry, parser, array, event, json, Memory, ObjectStore, FilteringSelect, domStyle, lang, util) {
+    function (xhr, dom, construct, win, registry, parser, array, event, json, Memory, ObjectStore, FilteringSelect, domStyle, lang, util, metadata) {
 
         var addPort = {};
 
         var node = construct.create("div", null, win.body(), "last");
 
+        addPort._typeChanged = function (newValue)
+        {
+            var typeMetaData = metadata.getMetaData("Port", newValue);
+
+            //protocols
+            var protocolsMultiSelect = dom.byId("formAddPort.protocols");
+            var protocolValidValues = typeMetaData.attributes.protocols.validValues;
+            var protocolValues = metadata.extractUniqueListOfValues(protocolValidValues);
+            util.setMultiSelectOptions(protocolsMultiSelect, protocolValues.sort());
+
+            //authenticationProvider
+            registry.byId("formAddPort.authenticationProvider").set("disabled", ! ("authenticationProvider" in typeMetaData.attributes));
+            dom.byId("formAddPort:fieldsAuthenticationProvider").style.display = "authenticationProvider" in typeMetaData.attributes ? "block" : "none";
+
+            //bindingAddress
+            registry.byId("formAddPort.bindingAddress").set("disabled", ! ("bindingAddress" in typeMetaData.attributes));
+            dom.byId("formAddPort:fieldsBindingAddress").style.display = "bindingAddress" in typeMetaData.attributes ? "block" : "none";
+
+            //transports
+            var transportsMultiSelect = dom.byId("formAddPort.transports");
+            var transportsValidValues = typeMetaData.attributes.transports.validValues;
+            var transportsValues = metadata.extractUniqueListOfValues(transportsValidValues);
+            util.setMultiSelectOptions(transportsMultiSelect, transportsValues.sort());
+
+            toggleSslWidgets(newValue, transportsMultiSelect.value);
+        };
+
         var convertToPort = function convertToPort(formValues)
             {
                 var newPort = {};
@@ -157,189 +185,107 @@ define(["dojo/_base/xhr",
                 return newPort;
             };
 
-            var toggleSslWidgets = function toggleSslWidgets(protocolType, transportType)
+            var toggleSslWidgets = function toggleSslWidgets(portType, transportType)
             {
                 var clientAuthPanel = dojo.byId("formAddPort:fieldsClientAuth");
-                var display = clientAuthPanel.style.display;
+                var transportSSLPanelNode = dom.byId("formAddPort:fieldsTransportSSL");
 
-                if ((transportType == "SSL" || (lang.isArray(transportType)  && array.indexOf(transportType, "SSL")>=0))
-                    && (protocolType == "AMQP" || protocolType == "HTTP"))
+                if (transportType == "SSL" || (lang.isArray(transportType) && array.indexOf(transportType, "SSL")>=0))
                 {
-                    clientAuthPanel.style.display = "block";
-                    registry.byId("formAddPort.needClientAuth").set("disabled", false);
-                    registry.byId("formAddPort.wantClientAuth").set("disabled", false);
+                    var typeMetaData = metadata.getMetaData("Port", portType);
+                    var clientAuth = "needClientAuth" in typeMetaData.attributes || "wantClientAuth" in typeMetaData.attributes;
+                    clientAuthPanel.style.display = clientAuth ? "block" : "none";
+                    if (clientAuth)
+                    {
+                        registry.byId("formAddPort.needClientAuth").set("disabled", !("needClientAuth" in typeMetaData.attributes));
+                        registry.byId("formAddPort.wantClientAuth").set("disabled", !("wantClientAuth" in typeMetaData.attributes));
+                        registry.byId("formAddPort.trustStores").resize();
+                    }
+
+                    transportSSLPanelNode.style.display = "block";
+                    registry.byId("formAddPort.keyStore").set("disabled", false);
                 }
                 else
                 {
                     clientAuthPanel.style.display = "none";
                     registry.byId("formAddPort.needClientAuth").set("disabled", true);
                     registry.byId("formAddPort.wantClientAuth").set("disabled", true);
-                }
 
-                var transportSSLPanelNode = dom.byId("formAddPort:fieldsTransportSSL");
-                var transportSSLPanelDisplay = transportSSLPanelNode.style.display;
-                if (transportType == "SSL" || (lang.isArray(transportType)  && array.indexOf(transportType, "SSL")>=0))
-                {
-                    transportSSLPanelNode.style.display = "block";
-                    registry.byId("formAddPort.keyStore").set("disabled", false);
-                }
-                else
-                {
                     transportSSLPanelNode.style.display = "none";
                     registry.byId("formAddPort.keyStore").set("disabled", true);
                 }
 
-                if (transportSSLPanelNode.style.display != transportSSLPanelDisplay && transportSSLPanelNode.style.display=="block")
-                {
-                    registry.byId("formAddPort.trustStores").resize();
-                }
             };
 
-        xhr.get({url: "addPort.html",
-                 sync: true,
-                 load:  function(data) {
-                            var theForm;
-                            node.innerHTML = data;
-                            addPort.dialogNode = dom.byId("addPort");
-                            parser.instantiate([addPort.dialogNode]);
-
-                            registry.byId("formAddPort.protocolsDefault").on("change", function(isChecked) {
-                                dijit.byId("formAddPort.protocolsAMQP").set("disabled", isChecked);
-                            });
-
-                            registry.byId("formAddPort.transports").on("change", function(newValue){
-                                var protocolType = registry.byId("formAddPort.type").value;
-                                if(lang.isArray(newValue) && newValue.length == 2 && protocolType == "JMX")
-                                {
-                                    registry.byId("formAddPort.transports").set("value", ["SSL"]);
-                                    newValue = "SSL"
-                                }
-                                toggleSslWidgets(protocolType, newValue);
-                            });
-
-                            registry.byId("formAddPort.type").on("change", function(newValue) {
-                                var typeWidget = registry.byId("formAddPort.type");
-                                var store = typeWidget.store;
-                                store.data.forEach(function(option){
-                                    registry.byId("formAddPort.protocols" + option.value).set("disabled", true);
-                                    dom.byId("formAddPort:fields" + option.value).style.display = "none";
-                                });
-
-                                var isAMQP = ("AMQP" == newValue);
-
-                                var isHTTP = ("HTTP" == newValue);
-
-                                registry.byId("formAddPort.needClientAuth").set("enabled", isAMQP || isHTTP);
-                                registry.byId("formAddPort.wantClientAuth").set("enabled", isAMQP || isHTTP);
-
-                                dom.byId("formAddPort:fields" + newValue).style.display = "block";
-                                var defaultsAMQPProtocols = registry.byId("formAddPort.protocolsDefault");
-                                defaultsAMQPProtocols.set("disabled", "AMQP" != newValue)
-                                var protocolsWidget = registry.byId("formAddPort.protocols" + newValue);
-                                if (protocolsWidget)
-                                {
-                                    protocolsWidget.set("disabled", (isAMQP && defaultsAMQPProtocols.checked));
-                                }
-
-                                var transportWidget = registry.byId("formAddPort.transports");
-                                var disableTransportWidget = false;
-                                var toggleSsl = true;
-                                var isRMI = (newValue == "JMX" && registry.byId("formAddPort.protocolsJMX").value == "RMI");
-                                if (isRMI)
-                                {
-                                    if  (transportWidget.value != "TCP")
-                                    {
-                                      transportWidget.set("value", ["TCP"]);
-
-                                      // changing of transport widget value will cause the call to toggleSslWidgets
-                                      toggleSsl = false;
-                                    }
-                                    disableTransportWidget = true;
-
-                                }
-                                else if(newValue == "JMX" )
-                                {
-                                    var transports = transportWidget.value;
-                                    if(lang.isArray(transports) && transports.length == 2)
-                                    {
-                                        transportWidget.set("value", ["SSL"]);
-                                    }
-                                }
-
-
-                                if (toggleSsl)
-                                {
-                                  toggleSslWidgets(newValue, transportWidget.value);
-                                }
-                                transportWidget.set("disabled", disableTransportWidget);
-                                registry.byId("formAddPort.authenticationProvider").set("disabled", isRMI);
-                                dom.byId("formAddPort:fieldsAuthenticationProvider").style.display = isRMI? "none" : "block";
-                                dom.byId("formAddPort:fieldsBindingAddress").style.display = newValue == "JMX" ? "none" : "block";
-                                dom.byId("formAddPort:transport").style.display = isRMI ? "none" : "block";
-
-
-
-                            });
-
-                            theForm = registry.byId("formAddPort");
-
-                            registry.byId("formAddPort.protocolsJMX").on("change", function(newValue){
-                                var isRMI = newValue == "RMI";
-                                var transportWidget = registry.byId("formAddPort.transports");
-                                if (isRMI && transportWidget.value != "TCP")
-                                {
-                                    transportWidget.set("value", "TCP");
-                                }
-                                transportWidget.set("disabled", isRMI);
-                                dom.byId("formAddPort:transport").style.display = isRMI ? "none" : "block";
-                                dom.byId("formAddPort:fieldsAuthenticationProvider").style.display = isRMI? "none" : "block";
-                                registry.byId("formAddPort.authenticationProvider").set("disabled", isRMI);
-                            });
-
-                            theForm.on("submit", function(e) {
-
-                                event.stop(e);
-                                if(theForm.validate()){
-
-                                    var newPort = convertToPort(theForm.getValues());
-                                    if ((newPort.needClientAuth || newPort.wantClientAuth) && (!newPort.hasOwnProperty("trustStores") || newPort.trustStores.length==0))
-                                    {
-                                      alert("A trust store must be selected when requesting client certificates.");
-                                      return false;
-                                    }
-                                    var that = this;
-
-                                    xhr.put({url: "api/latest/port/"+encodeURIComponent(newPort.name), sync: true, handleAs: "json",
-                                             headers: { "Content-Type": "application/json"},
-                                             putData: json.toJson(newPort),
-                                             load: function(x) {that.success = true; },
-                                             error: function(error) {that.success = false; that.failureReason = error;}});
-
-                                    if(this.success === true)
-                                    {
-                                        registry.byId("addPort").hide();
-                                    }
-                                    else
-                                    {
-                                        util.xhrErrorHandler(this.failureReason);
-                                    }
-
-                                    return false;
-
-
-                                }else{
-                                    alert('Form contains invalid data.  Please correct first');
-                                    return false;
-                                }
+            xhr.get({url: "addPort.html", sync: true, load:  function(data) {
+                var theForm;
+                node.innerHTML = data;
+                addPort.dialogNode = dom.byId("addPort");
+                parser.instantiate([addPort.dialogNode]);
+
+                //add the port types to formAddPort.type
+                var portTypeSelect = registry.byId("formAddPort.type");
+                var supportedPortTypes = metadata.getTypesForCategory("Port");
+                var portTypeSelectStore = util.makeTypeStore(supportedPortTypes);
+                portTypeSelect.set("store", portTypeSelectStore);
+
+                //add handler for transports change
+                registry.byId("formAddPort.transports").on("change", function(newValue){
+                    var portType = portTypeSelect.get("value");
+                    toggleSslWidgets(portType, newValue);
+                });
+
 
-                            });
-                        }});
+                theForm = registry.byId("formAddPort");
+                theForm.on("submit", function(e) {
 
-        addPort.show = function(portName, providers, keystores, truststores) {
+                    event.stop(e);
+                    if(theForm.validate()){
 
+                        var newPort = convertToPort(theForm.getValues());
+                        if ((newPort.needClientAuth || newPort.wantClientAuth) && (!newPort.hasOwnProperty("trustStores") || newPort.trustStores.length==0))
+                        {
+                          alert("A trust store must be selected when requesting client certificates.");
+                          return false;
+                        }
+                        var that = this;
+
+                        xhr.put({url: "api/latest/port/"+encodeURIComponent(newPort.name), sync: true, handleAs: "json",
+                                 headers: { "Content-Type": "application/json"},
+                                 putData: json.toJson(newPort),
+                                 load: function(x) {that.success = true; },
+                                 error: function(error) {that.success = false; that.failureReason = error;}});
+
+                        if(this.success === true)
+                        {
+                            registry.byId("addPort").hide();
+                        }
+                        else
+                        {
+                            util.xhrErrorHandler(this.failureReason);
+                        }
+
+                        return false;
+
+
+                    }else{
+                        alert('Form contains invalid data.  Please correct first');
+                        return false;
+                    }
+
+                });
+            }});
+
+
+        addPort.show = function(portName, portType, providers, keystores, truststores) {
             registry.byId("formAddPort").reset();
             dojo.byId("formAddPort.id").value = "";
+
+            var nameWidget = registry.byId("formAddPort.name");
+            var typeWidget = registry.byId("formAddPort.type");
+            var portWidget = registry.byId("formAddPort.port");
             var editWarning = dojo.byId("portEditWarning");
+
             var providerWidget = registry.byId("formAddPort.authenticationProvider");
             if (providers)
             {
@@ -354,7 +300,6 @@ define(["dojo/_base/xhr",
             }
 
             var keystoreWidget = registry.byId("formAddPort.keyStore");
-
             if (keystores)
             {
                 var data = [];
@@ -384,6 +329,12 @@ define(["dojo/_base/xhr",
                 truststoreWidget.startup();
             }
 
+            // Editing existing port, de-register existing on change handler if set
+            if (this.typeChangeHandler)
+            {
+                this.typeChangeHandler.remove();
+            }
+
             if (portName)
             {
                 editWarning.style.display = "block";
@@ -395,12 +346,47 @@ define(["dojo/_base/xhr",
                 }).then(
                    function(data){
                        var port = data[0];
-                       var nameWidget = registry.byId("formAddPort.name");
                        nameWidget.set("value", port.name);
                        nameWidget.set("disabled", true);
 
                        dom.byId("formAddPort.id").value=port.id;
+
+                       //type
+                       typeWidget.set("value", portType);
+                       typeWidget.set("disabled", true);
+                       var typeMetaData = metadata.getMetaData("Port", portType);
+
+                       //port number
+                       portWidget.set("value", port.port);
+                       portWidget.set("regExpGen", util.numericOrContextVarRegexp);
+
+                       //protocols
+                       var protocolsMultiSelect = dom.byId("formAddPort.protocols");
+                       var protocolValidValues = typeMetaData.attributes.protocols.validValues;
+                       var protocolValues = metadata.extractUniqueListOfValues(protocolValidValues);
+                       util.setMultiSelectOptions(protocolsMultiSelect, protocolValues.sort());
+
+                       var protocolsMultiSelectWidget = registry.byId("formAddPort.protocols");
+                       protocolsMultiSelectWidget.set("value", port.protocols);
+
+                       //authenticationProvider
                        providerWidget.set("value", port.authenticationProvider ? port.authenticationProvider : "");
+
+                       //transports
+                       var transportsMultiSelect = dom.byId("formAddPort.transports");
+                       var transportsValidValues = typeMetaData.attributes.transports.validValues;
+                       var transportsValues = metadata.extractUniqueListOfValues(transportsValidValues);
+                       util.setMultiSelectOptions(transportsMultiSelect, transportsValues.sort());
+                       var transportWidget = registry.byId("formAddPort.transports");
+                       transportWidget.set("value", port.transports);
+
+                       //binding address
+                       var bindAddressWidget = registry.byId("formAddPort.bindingAddress");
+                       bindAddressWidget.set("value", port.bindingAddress ? port.bindingAddress : "");
+                       bindAddressWidget.set("disabled", ! ("bindingAddress" in typeMetaData.attributes));
+                       dom.byId("formAddPort:fieldsBindingAddress").style.display = "bindingAddress" in typeMetaData.attributes ? "block" : "none";
+
+                       //ssl
                        keystoreWidget.set("value", port.keyStore ? port.keyStore : "");
                        if (port.trustStores)
                        {
@@ -421,64 +407,9 @@ define(["dojo/_base/xhr",
                          }
                        }
 
-                       var transportWidget = registry.byId("formAddPort.transports");
-                       transportWidget.set("value", port.transports);
-
-                       var portWidget = registry.byId("formAddPort.port");
-                       portWidget.set("value", port.port);
-                       portWidget.set("regExpGen", util.numericOrContextVarRegexp);
-
-                       var protocols = port.protocols;
-                       var typeWidget = registry.byId("formAddPort.type");
-
-                       var store = typeWidget.store;
-                       store.data.forEach(function(option){
-                           registry.byId("formAddPort.protocols" + option.value).set("disabled", true);
-                           dom.byId("formAddPort:fields" + option.value).style.display = "none";
-                       });
-
-                       // identify the type of port using first protocol specified in protocol field if provided
-                       if ( !protocols || protocols.length == 0 || protocols[0].indexOf("AMQP") == 0)
-                       {
-                           typeWidget.set("value", "AMQP");
-                           var amqpProtocolsWidget = registry.byId("formAddPort.protocolsAMQP");
-                           var defaultProtocolsWidget = registry.byId("formAddPort.protocolsDefault");
-                           var addressWidget = registry.byId("formAddPort.bindingAddress");
-                           addressWidget.set("value", port.bindingAddress);
-
-                           if (protocols)
-                           {
-                               amqpProtocolsWidget.set("value", protocols)
-                               amqpProtocolsWidget.set("disabled", false)
-                               defaultProtocolsWidget.set("checked", false);
-                           }
-                           else
-                           {
-                               defaultProtocolsWidget.set("checked", true);
-                               amqpProtocolsWidget.set("disabled", true)
-                           }
-
-                           registry.byId("formAddPort.needClientAuth").set("checked", port.needClientAuth);
-                           registry.byId("formAddPort.wantClientAuth").set("checked", port.wantClientAuth);
-                       }
-                       else if (protocols[0].indexOf("RMI") != -1)
-                       {
-                           var jmxProtocolsWidget = registry.byId("formAddPort.protocolsJMX");
-                           jmxProtocolsWidget.set("disabled", false);
-                           jmxProtocolsWidget.set("value", protocols[0]);
-                           typeWidget.set("value", "JMX");
-                       }
-                       else if (protocols[0].indexOf("HTTP") == 0)
-                       {
-                           var httpProtocolsWidget = registry.byId("formAddPort.protocolsHTTP");
-                           httpProtocolsWidget.set("disabled", false);
-                           httpProtocolsWidget.set("value", protocols[0]);
-                           typeWidget.set("value", "HTTP");
-                           var addressWidget = registry.byId("formAddPort.bindingAddress");
-                           addressWidget.set("value", port.bindingAddress)
-                       }
-                       dom.byId("formAddPort:fields" + typeWidget.value).style.display = "block";
-                       typeWidget.set("disabled", true);
+                       // want/need client auth
+                       registry.byId("formAddPort.needClientAuth").set("checked", port.needClientAuth);
+                       registry.byId("formAddPort.wantClientAuth").set("checked", port.wantClientAuth);
 
                        keystoreWidget.initialValue = port.keyStore;
                        truststoreWidget.initialValue = port.trustStores;
@@ -486,31 +417,29 @@ define(["dojo/_base/xhr",
                        providerWidget.initialValue = providerWidget.value;
 
                        registry.byId("addPort").show();
-                       util.applyMetadataToWidgets(registry.byId("addPort").domNode, "Port", typeWidget.get("value"));
-
+                       util.applyMetadataToWidgets(registry.byId("addPort").domNode, "Port", portType);
                    });
             }
             else
             {
-                // Creating new port
-                var typeWidget = registry.byId("formAddPort.type");
+                // Adding new port, register the on change handler
+                this.typeChangeHandler = typeWidget.on("change", addPort._typeChanged);
+
                 if (typeWidget.get("disabled"))
                 {
                   typeWidget.set("disabled", false);
                 }
-                typeWidget.set("value", "AMQP");
+                typeWidget.set("value", portType);
 
-                var nameWidget = registry.byId("formAddPort.name");
                 nameWidget.set("disabled", false);
                 nameWidget.set("regExpGen", util.nameOrContextVarRegexp);
 
-                var portWidget = registry.byId("formAddPort.port");
                 portWidget.set("regExpGen", util.numericOrContextVarRegexp);
 
                 editWarning.style.display = "none";
                 registry.byId("addPort").show();
 
-                util.applyMetadataToWidgets(registry.byId("addPort").domNode, "Port", "AMQP");
+                util.applyMetadataToWidgets(registry.byId("addPort").domNode, "Port", portType);
             }
 
         };

Modified: qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/showExchange.html
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/showExchange.html?rev=1620350&r1=1620349&r2=1620350&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/showExchange.html (original)
+++ qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/showExchange.html Mon Aug 25 15:35:10 2014
@@ -25,8 +25,37 @@
             <div class="name"></div>
         </div>
         <div class="clear">
-            <div class="formLabel-labelCell">State:</div>
-            <div class="state"></div>
+            <div class="alignLeft">
+
+                <div class="clear">
+                    <div class="formLabel-labelCell">Type:</div>
+                    <div class="type  formValue-valueCell"></div>
+                </div>
+                <div class="clear">
+                    <div class="formLabel-labelCell">State:</div>
+                    <div class="state formValue-valueCell"></div>
+                </div>
+            </div>
+            <div class="alignRight">
+                <div class="clear">
+                    <div class="formLabel-labelCell">Inbound:</div>
+                    <div class="formValue-valueCell">
+                        <span class="msgInRate"></span>
+                        <span> msg/s</span>
+                        <span class="bytesInRate">(</span>
+                        <span class="bytesInRateUnits">)</span>
+                    </div>
+                </div>
+                <div class="clear">
+                    <div class="formLabel-labelCell">Dropped:</div>
+                    <div class="formValue-valueCell">
+                        <span class="msgDropRate"></span>
+                        <span> msg/s</span>
+                        <span class="bytesDropRate">(</span>
+                        <span class="bytesDropRateUnits">)</span>
+                    </div>
+                </div>
+            </div>
         </div>
         <div class="clear">
             <div class="formLabel-labelCell">Durable:</div>
@@ -36,33 +65,18 @@
             <div class="formLabel-labelCell">Lifespan:</div>
             <div class="lifetimePolicy"></div>
         </div>
-        <div class="clear">
-            <div class="formLabel-labelCell">Inbound:</div>
-            <div>
-                <span class="msgInRate"></span>
-                <span> msg/s</span>
-                <span class="bytesInRate">(</span>
-                <span class="bytesInRateUnits">)</span>
-            </div>
-        </div>
-        <div class="clear">
-            <div class="formLabel-labelCell">Dropped:</div>
-            <div>
-                <span class="msgDropRate"></span>
-                <span> msg/s</span>
-                <span class="bytesDropRate">(</span>
-                <span class="bytesDropRateUnits">)</span>
-            </div>
-        </div>
+
         <div class="clear"></div>
     </div>
     <br/>
+
     <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Bindings'">
         <div class="bindings"></div>
         <button data-dojo-type="dijit.form.Button" class="addBindingButton">Add Binding</button>
         <button data-dojo-type="dijit.form.Button" class="deleteBindingButton">Delete Binding</button>
     </div>
     <br/>
+
     <div class="dijitDialogPaneActionBar">
         <button data-dojo-type="dijit.form.Button" class="deleteExchangeButton" type="button">Delete Exchange</button>
     </div>

Modified: qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/showPort.html
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/showPort.html?rev=1620350&r1=1620349&r2=1620350&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/showPort.html (original)
+++ qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/showPort.html Mon Aug 25 15:35:10 2014
@@ -26,6 +26,11 @@
            <div class="nameValue"></div>
        </div>
 
+       <div class="clear name">
+           <div class="formLabel-labelCell">Port Type:</div>
+           <div class="typeValue"></div>
+       </div>
+
        <div class="clear state">
            <div class="formLabel-labelCell">State:</div>
            <div class="stateValue"></div>
@@ -36,24 +41,24 @@
            <div class="portValue"></div>
        </div>
 
-       <div class="clear authenticationProvider">
-           <div class="formLabel-labelCell">Authentication Provider:</div>
-           <div class="authenticationProviderValue"></div>
-       </div>
-
        <div class="clear protocols">
            <div class="formLabel-labelCell">Protocols:</div>
-           <div class="protocolsValue"></div>
+           <div class="protocolsValue multiLineValue"></div>
        </div>
 
-       <div class="clear transports">
-           <div class="formLabel-labelCell">Transports:</div>
-           <div class="transportsValue"></div>
-       </div>
+        <div class="clear authenticationProvider">
+            <div class="formLabel-labelCell">Authentication Provider:</div>
+            <div class="authenticationProviderValue"></div>
+        </div>
 
-       <div class="clear bindingAddress">
-          <div class="formLabel-labelCell">Binding address:</div>
-          <div class="bindingAddressValue"></div>
+        <div class="clear bindingAddress">
+            <div class="formLabel-labelCell">Binding address:</div>
+            <div class="bindingAddressValue"></div>
+        </div>
+
+        <div class="clear transports">
+           <div class="formLabel-labelCell">Transports:</div>
+           <div class="transportsValue multiLineValue"></div>
        </div>
 
        <div class="clear keyStore">
@@ -73,7 +78,7 @@
 
        <div class="clear trustStores">
           <div class="formLabel-labelCell">Trust Stores:</div>
-          <div class="trustStoresValue"></div>
+          <div class="trustStoresValue multiLineValue"></div>
        </div>
 
     </div>

Modified: qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java?rev=1620350&r1=1620349&r2=1620350&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java (original)
+++ qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java Mon Aug 25 15:35:10 2014
@@ -58,7 +58,7 @@ public class ConfiguredObjectToMapConver
         when(_configuredObject.getStatistics()).thenReturn(Collections.singletonMap(statisticName, (Number) statisticValue));
 
         Map<String, Object> resultMap = _converter.convertObjectToMap(_configuredObject, ConfiguredObject.class, 0,
-                                                                      false, false);
+                                                                      false, false, false);
         Map<String, Object> statsAsMap = (Map<String, Object>) resultMap.get(STATISTICS_MAP_KEY);
         assertNotNull("Statistics should be part of map", statsAsMap);
         assertEquals("Unexpected number of statistics", 1, statsAsMap.size());
@@ -72,7 +72,7 @@ public class ConfiguredObjectToMapConver
         configureMockToReturnOneAttribute(_configuredObject, attributeName, attributeValue);
 
         Map<String, Object> resultMap = _converter.convertObjectToMap(_configuredObject, ConfiguredObject.class, 0,
-                                                                      false, false);
+                                                                      false, false, false);
         assertEquals("Unexpected number of attributes", 1, resultMap.size());
         assertEquals("Unexpected attribute value", attributeValue, resultMap.get(attributeName));
     }
@@ -90,7 +90,7 @@ public class ConfiguredObjectToMapConver
         configureMockToReturnOneAttribute(_configuredObject, attributeName, attributeValue);
 
         Map<String, Object> resultMap = _converter.convertObjectToMap(_configuredObject, ConfiguredObject.class, 0,
-                                                                      false, false);
+                                                                      false, false, false);
         assertEquals("Unexpected number of attributes", 1, resultMap.size());
         assertEquals("Unexpected attribute value", "attributeConfiguredObjectName", resultMap.get(attributeName));
     }
@@ -109,7 +109,7 @@ public class ConfiguredObjectToMapConver
         when(_configuredObject.getChildren(TestChild.class)).thenReturn(Arrays.asList(mockChild));
 
         Map<String, Object> resultMap = _converter.convertObjectToMap(_configuredObject, ConfiguredObject.class, 1,
-                                                                      false, false);
+                                                                      false, false, false);
         assertEquals("Unexpected parent map size", 1, resultMap.size());
 
         final List<Map<String, Object>> childList = (List<Map<String, Object>>) resultMap.get("testchilds");
@@ -146,18 +146,18 @@ public class ConfiguredObjectToMapConver
 
 
         Map<String, Object> resultMap = _converter.convertObjectToMap(_configuredObject, ConfiguredObject.class, 1, true,
-                                                                      false);
+                                                                      false, false);
         assertEquals("Unexpected parent map size", 2, resultMap.size());
         assertEquals("Incorrect context", resultMap.get(ConfiguredObject.CONTEXT), actualContext);
         List<Map<String, Object>> childList = (List<Map<String, Object>>) resultMap.get("testchilds");
         assertEquals("Unexpected number of children", 1, childList.size());
         Map<String, Object> childMap = childList.get(0);
-        assertEquals("Unexpected child map size", 2, childMap.size());
         assertNotNull(childMap);
+        assertEquals("Unexpected child map size", 1, childMap.size());
 
         assertEquals("Unexpected child attribute value", childActualAttributeValue, childMap.get(childAttributeName));
 
-        resultMap = _converter.convertObjectToMap(_configuredObject, ConfiguredObject.class, 1, false, false);
+        resultMap = _converter.convertObjectToMap(_configuredObject, ConfiguredObject.class, 1, false, false, false);
         assertEquals("Unexpected parent map size", 2, resultMap.size());
         Map<String, Object> inheritedContext = new HashMap<>();
         inheritedContext.put("key","value");
@@ -166,7 +166,7 @@ public class ConfiguredObjectToMapConver
         childList = (List<Map<String, Object>>) resultMap.get("testchilds");
         assertEquals("Unexpected number of children", 1, childList.size());
         childMap = childList.get(0);
-        assertEquals("Unexpected child map size", 2, childMap.size());
+        assertEquals("Unexpected child map size", 1, childMap.size());
         assertNotNull(childMap);
 
         assertEquals("Unexpected child attribute value", childAttributeValue, childMap.get(childAttributeName));

Modified: qpid/branches/0.30/qpid/java/broker-plugins/websocket/src/main/java/org/apache/qpid/server/transport/websocket/WebSocketProvider.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/broker-plugins/websocket/src/main/java/org/apache/qpid/server/transport/websocket/WebSocketProvider.java?rev=1620350&r1=1620349&r2=1620350&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/broker-plugins/websocket/src/main/java/org/apache/qpid/server/transport/websocket/WebSocketProvider.java (original)
+++ qpid/branches/0.30/qpid/java/broker-plugins/websocket/src/main/java/org/apache/qpid/server/transport/websocket/WebSocketProvider.java Mon Aug 25 15:35:10 2014
@@ -32,6 +32,8 @@ import java.util.Set;
 import javax.net.ssl.SSLContext;
 import javax.servlet.http.HttpServletRequest;
 
+import org.apache.qpid.server.model.port.AmqpPort;
+import org.apache.qpid.server.model.port.HttpPort;
 import org.eclipse.jetty.server.Connector;
 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.server.nio.SelectChannelConnector;
@@ -108,11 +110,22 @@ class WebSocketProvider implements Accep
         {
             throw new IllegalArgumentException("Unexpected transport on port " + _port.getName() + ":" + _transport);
         }
-        String bindingAddress = _port.getBindingAddress();
-        if(bindingAddress != null && !bindingAddress.trim().equals("") && !bindingAddress.trim().equals("*"))
+
+        String bindingAddress = null;
+        if (_port instanceof HttpPort)
+        {
+            bindingAddress = ((HttpPort)_port).getBindingAddress();
+        }
+        else if (_port instanceof AmqpPort)
+        {
+            bindingAddress = ((AmqpPort)_port).getBindingAddress();
+        }
+
+        if (bindingAddress != null && !bindingAddress.trim().equals("") && !bindingAddress.trim().equals("*"))
         {
             connector.setHost(bindingAddress.trim());
         }
+
         connector.setPort(_port.getPort());
         _server.addConnector(connector);
 

Modified: qpid/branches/0.30/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java?rev=1620350&r1=1620349&r2=1620350&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java (original)
+++ qpid/branches/0.30/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java Mon Aug 25 15:35:10 2014
@@ -87,6 +87,8 @@ public class AMQConnection extends Close
     private static final Logger _logger = LoggerFactory.getLogger(AMQConnection.class);
     private static final AtomicLong CONN_NUMBER_GENERATOR = new AtomicLong();
 
+    private static final long DEFAULT_CLOSE_TIMEOUT = 2000l;
+
     private final long _connectionNumber;
 
     /**
@@ -160,7 +162,6 @@ public class AMQConnection extends Close
 
     /** Thread Pool for executing connection level processes. Such as returning bounced messages. */
     private final ExecutorService _taskPool = Executors.newCachedThreadPool();
-    private static final long DEFAULT_TIMEOUT = 1000 * 30;
 
     private AMQConnectionDelegate _delegate;
 
@@ -873,7 +874,7 @@ public class AMQConnection extends Close
 
     public void close() throws JMSException
     {
-        close(DEFAULT_TIMEOUT);
+        close(DEFAULT_CLOSE_TIMEOUT);
     }
 
     public void close(long timeout) throws JMSException

Modified: qpid/branches/0.30/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_8_0.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_8_0.java?rev=1620350&r1=1620349&r2=1620350&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_8_0.java (original)
+++ qpid/branches/0.30/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_8_0.java Mon Aug 25 15:35:10 2014
@@ -43,6 +43,7 @@ import org.apache.qpid.client.protocol.A
 import org.apache.qpid.client.state.AMQState;
 import org.apache.qpid.client.state.StateWaiter;
 import org.apache.qpid.common.ServerPropertyNames;
+import org.apache.qpid.configuration.ClientProperties;
 import org.apache.qpid.framing.BasicQosBody;
 import org.apache.qpid.framing.BasicQosOkBody;
 import org.apache.qpid.framing.ChannelOpenBody;
@@ -67,6 +68,7 @@ public class AMQConnectionDelegate_8_0 i
     private static final Logger _logger = LoggerFactory.getLogger(AMQConnectionDelegate_8_0.class);
     private final AMQConnection _conn;
     private boolean _messageCompressionSupported;
+    private boolean _addrSyntaxSupported;
 
     public void closeConnection(long timeout) throws JMSException, AMQException
     {
@@ -76,6 +78,9 @@ public class AMQConnectionDelegate_8_0 i
     public AMQConnectionDelegate_8_0(AMQConnection conn)
     {
         _conn = conn;
+        _addrSyntaxSupported =
+                Boolean.parseBoolean(System.getProperty(ClientProperties.ADDR_SYNTAX_SUPPORTED_IN_0_8,
+                                                        String.valueOf(ClientProperties.DEFAULT_ADDR_SYNTAX_0_8_SUPPORT)));
     }
 
     protected boolean checkException(Throwable thrown)
@@ -429,4 +434,9 @@ public class AMQConnectionDelegate_8_0 i
     {
         return _messageCompressionSupported;
     }
+
+    public boolean isAddrSyntaxSupported()
+    {
+        return _addrSyntaxSupported;
+    }
 }

Modified: qpid/branches/0.30/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java?rev=1620350&r1=1620349&r2=1620350&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java (original)
+++ qpid/branches/0.30/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java Mon Aug 25 15:35:10 2014
@@ -20,6 +20,20 @@
  */
 package org.apache.qpid.client;
 
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.net.URISyntaxException;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+
+import javax.jms.Destination;
+import javax.naming.NamingException;
+import javax.naming.Reference;
+import javax.naming.Referenceable;
+import javax.naming.StringRefAddr;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -34,20 +48,6 @@ import org.apache.qpid.url.AMQBindingURL
 import org.apache.qpid.url.BindingURL;
 import org.apache.qpid.url.URLHelper;
 
-import javax.jms.Destination;
-import javax.naming.NamingException;
-import javax.naming.Reference;
-import javax.naming.Referenceable;
-import javax.naming.StringRefAddr;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.net.URISyntaxException;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicLong;
-
 
 public abstract class AMQDestination implements Destination, Referenceable, Externalizable
 {
@@ -813,7 +813,8 @@ public abstract class AMQDestination imp
         _address = addr;
     }
 
-    public int getAddressType(){
+    public int getAddressType()
+    {
         return _addressType;
     }
 

Modified: qpid/branches/0.30/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java?rev=1620350&r1=1620349&r2=1620350&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java (original)
+++ qpid/branches/0.30/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java Mon Aug 25 15:35:10 2014
@@ -68,9 +68,11 @@ import org.apache.qpid.client.message.JM
 import org.apache.qpid.client.message.JMSTextMessage;
 import org.apache.qpid.client.message.MessageFactoryRegistry;
 import org.apache.qpid.client.message.UnprocessedMessage;
+import org.apache.qpid.client.messaging.address.Node;
 import org.apache.qpid.client.util.FlowControllingBlockingQueue;
 import org.apache.qpid.common.AMQPFilterTypes;
 import org.apache.qpid.configuration.ClientProperties;
+import org.apache.qpid.exchange.ExchangeDefaults;
 import org.apache.qpid.framing.AMQShortString;
 import org.apache.qpid.framing.FieldTable;
 import org.apache.qpid.jms.ListMessage;
@@ -79,6 +81,7 @@ import org.apache.qpid.protocol.AMQConst
 import org.apache.qpid.thread.Threading;
 import org.apache.qpid.transport.SessionException;
 import org.apache.qpid.transport.TransportException;
+import org.apache.qpid.util.Strings;
 
 /*
  * TODO  Different FailoverSupport implementation are needed on the same method call, in different situations. For
@@ -310,6 +313,10 @@ public abstract class AMQSession<C exten
         return _immediatePrefetch;
     }
 
+    abstract void handleNodeDelete(final AMQDestination dest) throws AMQException;
+
+    abstract void handleLinkDelete(final AMQDestination dest) throws AMQException;
+
     public static final class IdToConsumerMap<C extends BasicMessageConsumer>
     {
         private final BasicMessageConsumer[] _fastAccessConsumers = new BasicMessageConsumer[16];
@@ -600,6 +607,128 @@ public abstract class AMQSession<C exten
         }
     }
 
+    public void setLegacyFieldsForQueueType(AMQDestination dest)
+    {
+        // legacy support
+        dest.setQueueName(new AMQShortString(dest.getAddressName()));
+        dest.setExchangeName(new AMQShortString(""));
+        dest.setExchangeClass(new AMQShortString(""));
+        dest.setRoutingKey(dest.getAMQQueueName());
+    }
+
+    public void setLegacyFieldsForTopicType(AMQDestination dest)
+    {
+        // legacy support
+        dest.setExchangeName(new AMQShortString(dest.getAddressName()));
+        Node node = dest.getNode();
+        dest.setExchangeClass(node.getExchangeType() == null?
+                              AMQShortString.valueOf(ExchangeDefaults.TOPIC_EXCHANGE_CLASS):
+                              new AMQShortString(node.getExchangeType()));
+        dest.setRoutingKey(new AMQShortString(dest.getSubject()));
+    }
+
+    protected void verifySubject(AMQDestination dest) throws AMQException
+    {
+        if (dest.getSubject() == null || dest.getSubject().trim().equals(""))
+        {
+
+            if ("topic".equals(dest.getExchangeClass().toString()))
+            {
+                dest.setRoutingKey(new AMQShortString("#"));
+                dest.setSubject(dest.getRoutingKey().toString());
+            }
+            else
+            {
+                dest.setRoutingKey(new AMQShortString(""));
+                dest.setSubject("");
+            }
+        }
+    }
+
+    public abstract boolean isExchangeExist(AMQDestination dest, boolean assertNode) throws AMQException;
+
+    public abstract boolean isQueueExist(AMQDestination dest, boolean assertNode) throws AMQException;
+
+    /**
+     * 1. Try to resolve the address type (queue or exchange)
+     * 2. if type == queue,
+     *       2.1 verify queue exists or create if create == true
+     *       2.2 If not throw exception
+     *
+     * 3. if type == exchange,
+     *       3.1 verify exchange exists or create if create == true
+     *       3.2 if not throw exception
+     *       3.3 if exchange exists (or created) create subscription queue.
+     */
+
+    @SuppressWarnings("deprecation")
+    public void resolveAddress(AMQDestination dest,
+                                              boolean isConsumer,
+                                              boolean noLocal) throws AMQException
+    {
+        if (dest.isAddressResolved() && dest.isResolvedAfter(getAMQConnection().getLastFailoverTime()))
+        {
+            return;
+        }
+        else
+        {
+            boolean assertNode = (dest.getAssert() == AMQDestination.AddressOption.ALWAYS) ||
+                                 (isConsumer && dest.getAssert() == AMQDestination.AddressOption.RECEIVER) ||
+                                 (!isConsumer && dest.getAssert() == AMQDestination.AddressOption.SENDER);
+
+            boolean createNode = (dest.getCreate() == AMQDestination.AddressOption.ALWAYS) ||
+                                 (isConsumer && dest.getCreate() == AMQDestination.AddressOption.RECEIVER) ||
+                                 (!isConsumer && dest.getCreate() == AMQDestination.AddressOption.SENDER);
+
+
+
+            int type = resolveAddressType(dest);
+
+            switch (type)
+            {
+                case AMQDestination.QUEUE_TYPE:
+                {
+                    if(createNode)
+                    {
+                        setLegacyFieldsForQueueType(dest);
+                        handleQueueNodeCreation(dest,noLocal);
+                        break;
+                    }
+                    else if (isQueueExist(dest,assertNode))
+                    {
+                        setLegacyFieldsForQueueType(dest);
+                        break;
+                    }
+                }
+
+                case AMQDestination.TOPIC_TYPE:
+                {
+                    if(createNode)
+                    {
+                        setLegacyFieldsForTopicType(dest);
+                        verifySubject(dest);
+                        handleExchangeNodeCreation(dest);
+                        break;
+                    }
+                    else if (isExchangeExist(dest,assertNode))
+                    {
+                        setLegacyFieldsForTopicType(dest);
+                        verifySubject(dest);
+                        break;
+                    }
+                }
+
+                default:
+                    throw new AMQException(
+                            "The name '" + dest.getAddressName() +
+                            "' supplied in the address doesn't resolve to an exchange or a queue");
+            }
+            dest.setAddressResolved(System.currentTimeMillis());
+        }
+    }
+
+    public abstract int resolveAddressType(AMQDestination dest) throws AMQException;
+
     protected abstract void acknowledgeImpl() throws JMSException;
 
     /**
@@ -2594,6 +2723,54 @@ public abstract class AMQSession<C exten
         }
     }
 
+    void handleLinkCreation(AMQDestination dest) throws AMQException
+    {
+        createBindings(dest, dest.getLink().getBindings());
+    }
+
+
+    void createBindings(AMQDestination dest, List<AMQDestination.Binding> bindings) throws AMQException
+    {
+        String defaultExchangeForBinding = dest.getAddressType() == AMQDestination.TOPIC_TYPE ? dest
+                .getAddressName() : "amq.topic";
+
+        String defaultQueueName = null;
+        if (AMQDestination.QUEUE_TYPE == dest.getAddressType())
+        {
+            defaultQueueName = dest.getQueueName();
+        }
+        else
+        {
+            defaultQueueName = dest.getLink().getName() != null ? dest.getLink().getName() : dest.getQueueName();
+        }
+
+        for (AMQDestination.Binding binding: bindings)
+        {
+            String queue = binding.getQueue() == null?
+                    defaultQueueName: binding.getQueue();
+
+            String exchange = binding.getExchange() == null ?
+                    defaultExchangeForBinding :
+                    binding.getExchange();
+
+            if (_logger.isDebugEnabled())
+            {
+                _logger.debug("Binding queue : " + queue +
+                              " exchange: " + exchange +
+                              " using binding key " + binding.getBindingKey() +
+                              " with args " + Strings.printMap(binding.getArgs()));
+            }
+            doBind(dest, binding, queue, exchange);
+        }
+    }
+
+    protected abstract void handleQueueNodeCreation(AMQDestination dest, boolean noLocal) throws AMQException;
+
+    abstract void handleExchangeNodeCreation(AMQDestination dest) throws AMQException;
+
+    abstract protected void doBind(final AMQDestination dest, final AMQDestination.Binding binding, final String queue, final String exchange)
+            throws AMQException;
+
     public abstract void sendConsume(C consumer, AMQShortString queueName,
                                      boolean nowait, int tag) throws AMQException, FailoverException;
 
@@ -2696,7 +2873,7 @@ public abstract class AMQSession<C exten
      * @throws AMQException If the exchange cannot be declared for any reason.
      * TODO  Be aware of possible changes to parameter order as versions change.
      */
-    private void declareExchange(final AMQShortString name, final AMQShortString type,
+    void declareExchange(final AMQShortString name, final AMQShortString type,
                                  final boolean nowait, final boolean durable,
                                  final boolean autoDelete, final boolean internal) throws AMQException
     {
@@ -2710,9 +2887,53 @@ public abstract class AMQSession<C exten
         }, _connection).execute();
     }
 
+    void declareExchange(final AMQShortString name, final AMQShortString type,
+                         final boolean nowait, final boolean durable,
+                         final boolean autoDelete, final FieldTable arguments,
+                         final boolean passive) throws AMQException
+    {
+        new FailoverNoopSupport<Object, AMQException>(new FailoverProtectedOperation<Object, AMQException>()
+        {
+            public Object execute() throws AMQException, FailoverException
+            {
+                sendExchangeDeclare(name, type, nowait, durable, autoDelete, arguments, passive);
+                return null;
+            }
+        }, _connection).execute();
+    }
+
+    protected AMQShortString preprocessAddressTopic(final C consumer,
+                                                    AMQShortString queueName) throws AMQException
+    {
+        if (DestSyntax.ADDR == consumer.getDestination().getDestSyntax())
+        {
+            if (AMQDestination.TOPIC_TYPE == consumer.getDestination().getAddressType())
+            {
+                String selector =  consumer.getMessageSelectorFilter() == null? null : consumer.getMessageSelectorFilter().getSelector();
+
+                createSubscriptionQueue(consumer.getDestination(), consumer.isNoLocal(), selector);
+                queueName = consumer.getDestination().getAMQQueueName();
+                consumer.setQueuename(queueName);
+            }
+            handleLinkCreation(consumer.getDestination());
+        }
+        return queueName;
+    }
+
+    abstract void createSubscriptionQueue(AMQDestination dest, boolean noLocal, String messageSelector) throws AMQException;
+
     public abstract void sendExchangeDeclare(final AMQShortString name, final AMQShortString type, final boolean nowait,
                                              boolean durable, boolean autoDelete, boolean internal) throws AMQException, FailoverException;
 
+
+    public abstract void sendExchangeDeclare(final AMQShortString name,
+                                             final AMQShortString type,
+                                             final boolean nowait,
+                                             boolean durable,
+                                             boolean autoDelete,
+                                             FieldTable arguments,
+                                             final boolean passive) throws AMQException, FailoverException;
+
     /**
      * Declares a queue for a JMS destination.
      * <p>
@@ -2930,10 +3151,6 @@ public abstract class AMQSession<C exten
     protected abstract boolean isBound(AMQShortString exchangeName, AMQShortString amqQueueName, AMQShortString routingKey)
             throws AMQException;
 
-    public abstract void resolveAddress(AMQDestination dest,
-                                                       boolean isConsumer,
-                                                       boolean noLocal) throws AMQException;
-
     private void registerProducer(long producerId, MessageProducer producer)
     {
         _producers.put(producerId, producer);

Modified: qpid/branches/0.30/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java?rev=1620350&r1=1620349&r2=1620350&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java (original)
+++ qpid/branches/0.30/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java Mon Aug 25 15:35:10 2014
@@ -42,7 +42,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.qpid.AMQException;
-import org.apache.qpid.client.AMQDestination.AddressOption;
 import org.apache.qpid.client.AMQDestination.Binding;
 import org.apache.qpid.client.AMQDestination.DestSyntax;
 import org.apache.qpid.client.failover.FailoverException;
@@ -57,7 +56,6 @@ import org.apache.qpid.client.messaging.
 import org.apache.qpid.client.messaging.address.Link.SubscriptionQueue;
 import org.apache.qpid.client.messaging.address.Node;
 import org.apache.qpid.common.AMQPFilterTypes;
-import org.apache.qpid.exchange.ExchangeDefaults;
 import org.apache.qpid.framing.AMQShortString;
 import org.apache.qpid.framing.FieldTable;
 import org.apache.qpid.protocol.AMQConstant;
@@ -395,10 +393,7 @@ public class AMQSession_0_10 extends AMQ
                               " exchange: " + exchange +
                               " using binding key " + binding.getBindingKey() +
                               " with args " + Strings.printMap(binding.getArgs()));
-                getQpidSession().exchangeBind(queue,
-                                              exchange,
-                                              binding.getBindingKey(),
-                                              binding.getArgs());
+                doBind(destination, binding, queue, exchange);
             }
         }
 
@@ -639,18 +634,7 @@ public class AMQSession_0_10 extends AMQ
                             boolean nowait, int tag)
             throws AMQException, FailoverException
     {
-        if (AMQDestination.DestSyntax.ADDR == consumer.getDestination().getDestSyntax())
-        {
-            if (AMQDestination.TOPIC_TYPE == consumer.getDestination().getAddressType())
-            {
-                String selector =  consumer.getMessageSelectorFilter() == null? null : consumer.getMessageSelectorFilter().getSelector();
-
-                createSubscriptionQueue(consumer.getDestination(), consumer.isNoLocal(), selector);
-                queueName = consumer.getDestination().getAMQQueueName();
-                consumer.setQueuename(queueName);
-            }
-            handleLinkCreation(consumer.getDestination());
-        }
+        queueName = preprocessAddressTopic(consumer, queueName);
         boolean preAcquire = consumer.isPreAcquire();
 
         AMQDestination destination = consumer.getDestination();
@@ -728,6 +712,15 @@ public class AMQSession_0_10 extends AMQ
         sendExchangeDeclare(name.asString(), type.asString(), null, null, nowait, durable, autoDelete);
     }
 
+    public void sendExchangeDeclare(final AMQShortString name, final AMQShortString type, final boolean nowait,
+                                    boolean durable, boolean autoDelete, FieldTable arguments, final boolean passive) throws AMQException, FailoverException
+    {
+        sendExchangeDeclare(name.asString(), type.asString(), null,
+                            arguments == null ? null : FieldTableSupport.convertToMap(arguments),
+                            nowait, durable, autoDelete);
+    }
+
+
     public void sendExchangeDeclare(final String name, final String type,
             final String alternateExchange, final Map<String, Object> args,
             final boolean nowait, boolean durable, boolean autoDelete) throws AMQException
@@ -1109,6 +1102,7 @@ public class AMQSession_0_10 extends AMQ
         return AMQMessageDelegateFactory.FACTORY_0_10;
     }
 
+    @Override
     public boolean isExchangeExist(AMQDestination dest,boolean assertNode) throws AMQException
     {
         boolean match = true;
@@ -1144,6 +1138,7 @@ public class AMQSession_0_10 extends AMQ
         return match;
     }
 
+    @Override
     public boolean isQueueExist(AMQDestination dest, boolean assertNode) throws AMQException
     {
         Node node = dest.getNode();
@@ -1218,84 +1213,7 @@ public class AMQSession_0_10 extends AMQ
         return match;
     }
 
-    /**
-     * 1. Try to resolve the address type (queue or exchange)
-     * 2. if type == queue,
-     *       2.1 verify queue exists or create if create == true
-     *       2.2 If not throw exception
-     *
-     * 3. if type == exchange,
-     *       3.1 verify exchange exists or create if create == true
-     *       3.2 if not throw exception
-     *       3.3 if exchange exists (or created) create subscription queue.
-     */
-
-    @SuppressWarnings("deprecation")
-    public void resolveAddress(AMQDestination dest,
-                                              boolean isConsumer,
-                                              boolean noLocal) throws AMQException
-    {
-        if (dest.isAddressResolved() && dest.isResolvedAfter(getAMQConnection().getLastFailoverTime()))
-        {
-            return;
-        }
-        else
-        {
-            boolean assertNode = (dest.getAssert() == AddressOption.ALWAYS) ||
-                                 (isConsumer && dest.getAssert() == AddressOption.RECEIVER) ||
-                                 (!isConsumer && dest.getAssert() == AddressOption.SENDER);
-
-            boolean createNode = (dest.getCreate() == AddressOption.ALWAYS) ||
-                                 (isConsumer && dest.getCreate() == AddressOption.RECEIVER) ||
-                                 (!isConsumer && dest.getCreate() == AddressOption.SENDER);
-
-
-
-            int type = resolveAddressType(dest);
-
-            switch (type)
-            {
-                case AMQDestination.QUEUE_TYPE:
-                {
-                    if(createNode)
-                    {
-                        setLegacyFieldsForQueueType(dest);
-                        handleQueueNodeCreation(dest,noLocal);
-                        break;
-                    }
-                    else if (isQueueExist(dest,assertNode))
-                    {
-                        setLegacyFieldsForQueueType(dest);
-                        break;
-                    }
-                }
-
-                case AMQDestination.TOPIC_TYPE:
-                {
-                    if(createNode)
-                    {
-                        setLegacyFiledsForTopicType(dest);
-                        verifySubject(dest);
-                        handleExchangeNodeCreation(dest);
-                        break;
-                    }
-                    else if (isExchangeExist(dest,assertNode))
-                    {
-                        setLegacyFiledsForTopicType(dest);
-                        verifySubject(dest);
-                        break;
-                    }
-                }
-
-                default:
-                    throw new AMQException(
-                            "The name '" + dest.getAddressName() +
-                            "' supplied in the address doesn't resolve to an exchange or a queue");
-            }
-            dest.setAddressResolved(System.currentTimeMillis());
-        }
-    }
-
+    @Override
     public int resolveAddressType(AMQDestination dest) throws AMQException
     {
        int type = dest.getAddressType();
@@ -1325,24 +1243,7 @@ public class AMQSession_0_10 extends AMQ
         }
     }
 
-    private void verifySubject(AMQDestination dest) throws AMQException
-    {
-        if (dest.getSubject() == null || dest.getSubject().trim().equals(""))
-        {
-
-            if ("topic".equals(dest.getExchangeClass().toString()))
-            {
-                dest.setRoutingKey(new AMQShortString("#"));
-                dest.setSubject(dest.getRoutingKey().toString());
-            }
-            else
-            {
-                dest.setRoutingKey(new AMQShortString(""));
-                dest.setSubject("");
-            }
-        }
-    }
-
+    @Override
     void createSubscriptionQueue(AMQDestination dest, boolean noLocal, String messageSelector) throws AMQException
     {
         Link link = dest.getLink();
@@ -1380,26 +1281,6 @@ public class AMQSession_0_10 extends AMQ
                               bindingArguments);
     }
 
-    public void setLegacyFieldsForQueueType(AMQDestination dest)
-    {
-        // legacy support
-        dest.setQueueName(new AMQShortString(dest.getAddressName()));
-        dest.setExchangeName(new AMQShortString(""));
-        dest.setExchangeClass(new AMQShortString(""));
-        dest.setRoutingKey(dest.getAMQQueueName());
-    }
-
-    public void setLegacyFiledsForTopicType(AMQDestination dest)
-    {
-        // legacy support
-        dest.setExchangeName(new AMQShortString(dest.getAddressName()));
-        Node node = dest.getNode();
-        dest.setExchangeClass(node.getExchangeType() == null?
-                              AMQShortString.valueOf(ExchangeDefaults.TOPIC_EXCHANGE_CLASS):
-                              new AMQShortString(node.getExchangeType()));
-        dest.setRoutingKey(new AMQShortString(dest.getSubject()));
-    }
-
     protected void acknowledgeImpl()
     {
         RangeSet ranges = gatherRangeSet(getUnacknowledgedMessageTags());
@@ -1488,7 +1369,8 @@ public class AMQSession_0_10 extends AMQ
         }
     }
 
-    private void handleQueueNodeCreation(AMQDestination dest, boolean noLocal) throws AMQException
+    @Override
+    protected void handleQueueNodeCreation(AMQDestination dest, boolean noLocal) throws AMQException
     {
         Node node = dest.getNode();
         Map<String,Object> arguments = node.getDeclareArgs();
@@ -1506,6 +1388,7 @@ public class AMQSession_0_10 extends AMQ
         sync();
     }
 
+    @Override
     void handleExchangeNodeCreation(AMQDestination dest) throws AMQException
     {
         Node node = dest.getNode();
@@ -1523,47 +1406,12 @@ public class AMQSession_0_10 extends AMQ
         sync();
     }
 
-    void handleLinkCreation(AMQDestination dest) throws AMQException
-    {
-        createBindings(dest, dest.getLink().getBindings());
-    }
-
-    void createBindings(AMQDestination dest, List<Binding> bindings)
+    protected void doBind(final AMQDestination dest, final Binding binding, final String queue, final String exchange)
     {
-        String defaultExchangeForBinding = dest.getAddressType() == AMQDestination.TOPIC_TYPE ? dest
-                .getAddressName() : "amq.topic";
-
-        String defaultQueueName = null;
-        if (AMQDestination.QUEUE_TYPE == dest.getAddressType())
-        {
-            defaultQueueName = dest.getQueueName();
-        }
-        else
-        {
-            defaultQueueName = dest.getLink().getName() != null ? dest.getLink().getName() : dest.getQueueName();
-        }
-
-        for (Binding binding: bindings)
-        {
-            String queue = binding.getQueue() == null?
-                    defaultQueueName: binding.getQueue();
-
-            String exchange = binding.getExchange() == null ?
-                        defaultExchangeForBinding :
-                        binding.getExchange();
-
-            if (_logger.isDebugEnabled())
-            {
-                _logger.debug("Binding queue : " + queue +
-                         " exchange: " + exchange +
-                         " using binding key " + binding.getBindingKey() +
-                         " with args " + Strings.printMap(binding.getArgs()));
-            }
-            getQpidSession().exchangeBind(queue,
-                                     exchange,
-                                     binding.getBindingKey(),
-                                     binding.getArgs());
-       }
+        getQpidSession().exchangeBind(queue,
+                                      exchange,
+                                      binding.getBindingKey(),
+                                      binding.getArgs());
     }
 
     void handleLinkDelete(AMQDestination dest) throws AMQException
@@ -1614,6 +1462,7 @@ public class AMQSession_0_10 extends AMQ
         }
     }
 
+    @Override
     void handleNodeDelete(AMQDestination dest) throws AMQException
     {
         if (AMQDestination.TOPIC_TYPE == dest.getAddressType())



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