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/09/08 14:36:24 UTC

svn commit: r1623378 - in /qpid/branches/0.30/qpid/java: broker-core/src/main/java/org/apache/qpid/server/model/port/ broker-plugins/management-http/src/main/java/resources/ broker-plugins/management-http/src/main/java/resources/js/qpid/common/ broker-...

Author: rgodfrey
Date: Mon Sep  8 12:36:23 2014
New Revision: 1623378

URL: http://svn.apache.org/r1623378
Log:
QPID-6068 : Merged revisions 1622677, 1622747, 1622768 from trunk to 0.30

Added:
    qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractClientAuthCapablePortWithAuthProvider.java
    qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/ClientAuthCapablePort.java
Modified:
    qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPort.java
    qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPortWithAuthProvider.java
    qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AmqpPort.java
    qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AmqpPortImpl.java
    qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/HttpPort.java
    qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/HttpPortImpl.java
    qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/JmxPortImpl.java
    qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/addPort.html
    qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/widgetconfigurer.js
    qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Port.js
    qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPort.js

Added: qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractClientAuthCapablePortWithAuthProvider.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractClientAuthCapablePortWithAuthProvider.java?rev=1623378&view=auto
==============================================================================
--- qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractClientAuthCapablePortWithAuthProvider.java (added)
+++ qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractClientAuthCapablePortWithAuthProvider.java Mon Sep  8 12:36:23 2014
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.qpid.server.model.port;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.qpid.server.configuration.IllegalConfigurationException;
+import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.model.ConfiguredObject;
+import org.apache.qpid.server.model.ManagedAttributeField;
+
+abstract public class AbstractClientAuthCapablePortWithAuthProvider<X extends AbstractClientAuthCapablePortWithAuthProvider<X>> extends AbstractPortWithAuthProvider<X>
+        implements ClientAuthCapablePort<X>
+{
+    public static final String DEFAULT_AMQP_NEED_CLIENT_AUTH = "false";
+    public static final String DEFAULT_AMQP_WANT_CLIENT_AUTH = "false";
+
+    @ManagedAttributeField
+    private boolean _needClientAuth;
+
+    @ManagedAttributeField
+    private boolean _wantClientAuth;
+
+    public AbstractClientAuthCapablePortWithAuthProvider(final Map<String, Object> attributes,
+                                                         final Broker<?> broker)
+    {
+        super(attributes, broker);
+    }
+
+    @Override
+    public boolean getNeedClientAuth()
+    {
+        return _needClientAuth;
+    }
+
+    @Override
+    public boolean getWantClientAuth()
+    {
+        return _wantClientAuth;
+    }
+
+    @Override
+    public void onValidate()
+    {
+        super.onValidate();
+        boolean useClientAuth = getNeedClientAuth() || getWantClientAuth();
+
+        if(useClientAuth && (getTrustStores() == null || getTrustStores().isEmpty()))
+        {
+            throw new IllegalConfigurationException("Can't create port which requests SSL client certificates but has no trust stores configured.");
+        }
+
+        boolean useTLSTransport = isUsingTLSTransport();
+        if(useClientAuth && !useTLSTransport)
+        {
+            throw new IllegalConfigurationException(
+                    "Can't create port which requests SSL client certificates but doesn't use SSL transport.");
+        }
+    }
+
+    @Override
+    protected void validateChange(final ConfiguredObject<?> proxyForValidation, final Set<String> changedAttributes)
+    {
+        super.validateChange(proxyForValidation, changedAttributes);
+        ClientAuthCapablePort<?> updated = (ClientAuthCapablePort<?>)proxyForValidation;
+
+        boolean requiresCertificate = updated.getNeedClientAuth() || updated.getWantClientAuth();
+
+        boolean usesSsl = isUsingTLSTransport(updated.getTransports());
+        if (usesSsl)
+        {
+            if ((updated.getTrustStores() == null || updated.getTrustStores().isEmpty() ) && requiresCertificate)
+            {
+                throw new IllegalConfigurationException("Can't create port which requests SSL client certificates but has no trust store configured.");
+            }
+        }
+        else
+        {
+            if (requiresCertificate)
+            {
+                throw new IllegalConfigurationException("Can't create port which requests SSL client certificates but doesn't use SSL transport.");
+            }
+        }
+    }
+}

Modified: qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPort.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPort.java?rev=1623378&r1=1623377&r2=1623378&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPort.java (original)
+++ qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPort.java Mon Sep  8 12:36:23 2014
@@ -149,7 +149,7 @@ abstract public class AbstractPort<X ext
     {
         super.onValidate();
 
-        boolean useTLSTransport = getTransports().contains(Transport.SSL) || getTransports().contains(Transport.WSS);
+        boolean useTLSTransport = isUsingTLSTransport();
 
         if(useTLSTransport && getKeyStore() == null)
         {
@@ -175,6 +175,28 @@ abstract public class AbstractPort<X ext
         }
     }
 
+    protected final boolean isUsingTLSTransport()
+    {
+        return isUsingTLSTransport(getTransports());
+    }
+
+    protected final boolean isUsingTLSTransport(final Collection<Transport> transports)
+    {
+        boolean usesTLS = false;
+        if(transports != null)
+        {
+            for (Transport transport : transports)
+            {
+                if (transport.isSecure())
+                {
+                    usesTLS = true;
+                    break;
+                }
+            }
+        }
+        return usesTLS;
+    }
+
     @Override
     protected void validateChange(final ConfiguredObject<?> proxyForValidation, final Set<String> changedAttributes)
     {
@@ -215,7 +237,7 @@ abstract public class AbstractPort<X ext
         Collection<Protocol> protocols = updated.getProtocols();
 
 
-        boolean usesSsl = transports != null && transports.contains(Transport.SSL);
+        boolean usesSsl = isUsingTLSTransport(transports);
         if (usesSsl)
         {
             if (updated.getKeyStore() == null)

Modified: qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPortWithAuthProvider.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPortWithAuthProvider.java?rev=1623378&r1=1623377&r2=1623378&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPortWithAuthProvider.java (original)
+++ qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPortWithAuthProvider.java Mon Sep  8 12:36:23 2014
@@ -21,46 +21,22 @@
 package org.apache.qpid.server.model.port;
 
 import java.util.Map;
-import java.util.Set;
 
-import org.apache.qpid.server.configuration.IllegalConfigurationException;
 import org.apache.qpid.server.model.AuthenticationProvider;
 import org.apache.qpid.server.model.Broker;
-import org.apache.qpid.server.model.ConfiguredObject;
 import org.apache.qpid.server.model.ManagedAttributeField;
-import org.apache.qpid.server.model.Port;
-import org.apache.qpid.server.model.Transport;
 
 abstract public class AbstractPortWithAuthProvider<X extends AbstractPortWithAuthProvider<X>> extends AbstractPort<X>
 {
-    public static final String DEFAULT_AMQP_NEED_CLIENT_AUTH = "false";
-    public static final String DEFAULT_AMQP_WANT_CLIENT_AUTH = "false";
-
     @ManagedAttributeField
     private AuthenticationProvider _authenticationProvider;
 
-    @ManagedAttributeField
-    private boolean _needClientAuth;
-
-    @ManagedAttributeField
-    private boolean _wantClientAuth;
-
     public AbstractPortWithAuthProvider(final Map<String, Object> attributes,
                                         final Broker<?> broker)
     {
         super(attributes, broker);
     }
 
-    public boolean getNeedClientAuth()
-    {
-        return _needClientAuth;
-    }
-
-    public boolean getWantClientAuth()
-    {
-        return _wantClientAuth;
-    }
-
     public AuthenticationProvider getAuthenticationProvider()
     {
         Broker<?> broker = getParent(Broker.class);
@@ -70,55 +46,4 @@ abstract public class AbstractPortWithAu
         }
         return _authenticationProvider;
     }
-
-    @Override
-    public void onValidate()
-    {
-        super.onValidate();
-        boolean useClientAuth = getNeedClientAuth() || getWantClientAuth();
-
-        if(useClientAuth && (getTrustStores() == null || getTrustStores().isEmpty()))
-        {
-            throw new IllegalConfigurationException("Can't create port which requests SSL client certificates but has no trust stores configured.");
-        }
-
-        boolean useTLSTransport = getTransports().contains(Transport.SSL) || getTransports().contains(Transport.WSS);
-        if(useClientAuth && !useTLSTransport)
-        {
-            throw new IllegalConfigurationException(
-                    "Can't create port which requests SSL client certificates but doesn't use SSL transport.");
-        }
-
-    }
-
-
-    @Override
-    protected void validateChange(final ConfiguredObject<?> proxyForValidation, final Set<String> changedAttributes)
-    {
-        super.validateChange(proxyForValidation, changedAttributes);
-        Port<?> updated = (Port<?>)proxyForValidation;
-
-        boolean needClientCertificate = (Boolean) updated.getAttribute(NEED_CLIENT_AUTH);
-        boolean wantClientCertificate = (Boolean) updated.getAttribute(WANT_CLIENT_AUTH);
-        boolean requiresCertificate = needClientCertificate || wantClientCertificate;
-
-        boolean usesSsl = updated.getTransports().contains(Transport.SSL);
-        if (usesSsl)
-        {
-            if ((updated.getTrustStores() == null || updated.getTrustStores().isEmpty() ) && requiresCertificate)
-            {
-                throw new IllegalConfigurationException("Can't create port which requests SSL client certificates but has no trust store configured.");
-            }
-        }
-        else
-        {
-            if (requiresCertificate)
-            {
-                throw new IllegalConfigurationException("Can't create port which requests SSL client certificates but doesn't use SSL transport.");
-            }
-        }
-
-
-
-    }
 }

Modified: qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AmqpPort.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AmqpPort.java?rev=1623378&r1=1623377&r2=1623378&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AmqpPort.java (original)
+++ qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AmqpPort.java Mon Sep  8 12:36:23 2014
@@ -32,7 +32,7 @@ import org.apache.qpid.server.model.Tran
 import org.apache.qpid.server.virtualhost.VirtualHostImpl;
 
 @ManagedObject( category = false, type = "AMQP")
-public interface AmqpPort<X extends AmqpPort<X>> extends Port<X>
+public interface AmqpPort<X extends AmqpPort<X>> extends ClientAuthCapablePort<X>
 {
     String DEFAULT_AMQP_SEND_BUFFER_SIZE = "262144";
     String DEFAULT_AMQP_RECEIVE_BUFFER_SIZE = "262144";

Modified: qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AmqpPortImpl.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AmqpPortImpl.java?rev=1623378&r1=1623377&r2=1623378&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AmqpPortImpl.java (original)
+++ qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AmqpPortImpl.java Mon Sep  8 12:36:23 2014
@@ -57,7 +57,7 @@ import org.apache.qpid.server.util.Serve
 import org.apache.qpid.server.virtualhost.VirtualHostImpl;
 import org.apache.qpid.transport.network.security.ssl.QpidMultipleTrustManager;
 
-public class AmqpPortImpl extends AbstractPortWithAuthProvider<AmqpPortImpl> implements AmqpPort<AmqpPortImpl>
+public class AmqpPortImpl extends AbstractClientAuthCapablePortWithAuthProvider<AmqpPortImpl> implements AmqpPort<AmqpPortImpl>
 {
 
     public static final String DEFAULT_BINDING_ADDRESS = "*";

Added: qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/ClientAuthCapablePort.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/ClientAuthCapablePort.java?rev=1623378&view=auto
==============================================================================
--- qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/ClientAuthCapablePort.java (added)
+++ qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/ClientAuthCapablePort.java Mon Sep  8 12:36:23 2014
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.qpid.server.model.port;
+
+import org.apache.qpid.server.model.Port;
+
+
+public interface ClientAuthCapablePort<X extends Port<X>> extends Port<X>
+{
+    boolean getNeedClientAuth();
+
+    boolean getWantClientAuth();
+}

Modified: qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/HttpPort.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/HttpPort.java?rev=1623378&r1=1623377&r2=1623378&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/HttpPort.java (original)
+++ qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/HttpPort.java Mon Sep  8 12:36:23 2014
@@ -30,9 +30,8 @@ import org.apache.qpid.server.model.Prot
 import org.apache.qpid.server.model.Transport;
 
 @ManagedObject( category = false, type = "HTTP")
-public interface HttpPort<X extends HttpPort<X>> extends Port<X>
+public interface HttpPort<X extends HttpPort<X>> extends ClientAuthCapablePort<X>
 {
-
     String DEFAULT_AMQP_NEED_CLIENT_AUTH = "false";
     String DEFAULT_AMQP_WANT_CLIENT_AUTH = "false";
 

Modified: qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/HttpPortImpl.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/HttpPortImpl.java?rev=1623378&r1=1623377&r2=1623378&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/HttpPortImpl.java (original)
+++ qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/HttpPortImpl.java Mon Sep  8 12:36:23 2014
@@ -20,17 +20,14 @@
  */
 package org.apache.qpid.server.model.port;
 
-import java.util.Collections;
 import java.util.Map;
-import java.util.Set;
 
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.model.ManagedAttributeField;
 import org.apache.qpid.server.model.ManagedObjectFactoryConstructor;
-import org.apache.qpid.server.model.Protocol;
 import org.apache.qpid.server.model.State;
 
-public class HttpPortImpl extends AbstractPortWithAuthProvider<HttpPortImpl> implements HttpPort<HttpPortImpl>
+public class HttpPortImpl extends AbstractClientAuthCapablePortWithAuthProvider<HttpPortImpl> implements HttpPort<HttpPortImpl>
 {
     private PortManager _portManager;
 

Modified: qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/JmxPortImpl.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/JmxPortImpl.java?rev=1623378&r1=1623377&r2=1623378&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/JmxPortImpl.java (original)
+++ qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/JmxPortImpl.java Mon Sep  8 12:36:23 2014
@@ -20,13 +20,10 @@
  */
 package org.apache.qpid.server.model.port;
 
-import java.util.Collections;
 import java.util.Map;
-import java.util.Set;
 
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.model.ManagedObjectFactoryConstructor;
-import org.apache.qpid.server.model.Protocol;
 import org.apache.qpid.server.model.State;
 
 public class JmxPortImpl extends AbstractPortWithAuthProvider<JmxPortImpl> implements JmxPort<JmxPortImpl>

Modified: qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/addPort.html
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/addPort.html?rev=1623378&r1=1623377&r2=1623378&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/addPort.html (original)
+++ qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/addPort.html Mon Sep  8 12:36:23 2014
@@ -78,7 +78,7 @@
             <div id="formAddPort:fieldsProtocols">
                 <div class="clear">
                     <div class="formLabel-labelCell">
-                        <label for="formAddPort.protocols">Protocols*:</label>
+                        <label for="formAddPort.protocols">Protocols:</label>
                     </div>
                     <div class="formLabel-controlCell">
                         <select id="formAddPort.protocols"
@@ -86,11 +86,15 @@
                                 data-dojo-props="
                                     name: 'protocols',
                                     value: '',
-                                    label: 'protocol*:',
-                                    promptMessage: 'Protocol to be associated with this port',
-                                    title: 'Enter protocol to be associated with this port'">
+                                    title: 'Select protocol(s) to be associated with this port'">
                         </select>
                     </div>
+                    <div id="formAddPort.protocols.tooltip"
+                         data-dojo-type="dijit.Tooltip"
+                         data-dojo-props="connectId: 'formAddPort.protocols',
+                                          label: 'Protocol(s) to be associated with the port'">
+                    </div>
+
                 </div>
             </div>
 
@@ -144,9 +148,13 @@
                                     placeHolder: 'TCP',
                                     value: '',
                                     multiple: true,
-                                    promptMessage: 'Transport(s)',
-                                    title: 'Select transports'">
+                                    title: 'Select transport(s) to be associated with the port'">
                         </select>
+                        <div id="formAddPort.transports.tooltip"
+                             data-dojo-type="dijit.Tooltip"
+                             data-dojo-props="connectId: 'formAddPort.transports',
+                                              label: 'Transport(s) to be associated with the port'">
+                        </div>
                     </div>
                 </div>
             </div>

Modified: qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/widgetconfigurer.js
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/widgetconfigurer.js?rev=1623378&r1=1623377&r2=1623378&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/widgetconfigurer.js (original)
+++ qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/widgetconfigurer.js Mon Sep  8 12:36:23 2014
@@ -23,12 +23,13 @@ define(["dojo/_base/xhr",
         "dojo/dom",
         "dojo/dom-construct",
         "dojo/dom-attr",
+        "dijit/registry",
         "qpid/common/properties",
         "qpid/common/metadata",
         "dojo/text!strings.html",
         "dojo/domReady!"
         ],
-  function (xhr, string, query, dom, domConstruct, domAttr, properties, metadata, template)
+  function (xhr, string, query, dom, domConstruct, domAttr, registry, properties, metadata, template)
   {
    var widgetconfigurer =
    {
@@ -67,6 +68,32 @@ define(["dojo/_base/xhr",
                }
            }
        }
+       else if  (widget instanceof dijit.Tooltip)
+       {
+         // If it is a tooltop, find the connected widget and use its name to lookup the default from the metadata.
+         if (typeof widget.get("qpid.originalLabel") == "undefined")
+         {
+           widget.set("qpid.originalLabel", widget.get("label"));
+         }
+
+         var message = widget.get("qpid.originalLabel");
+         var connectId = widget.get("connectId")[0];
+         var connectWidget = registry.byId(connectId);
+         if (connectWidget)
+         {
+           var connectWidgetName = connectWidget.get("name");
+           var defaultValue = metadata.getDefaultValueForAttribute(category, type, connectWidgetName);
+           if (defaultValue)
+           {
+             var newMessage = string.substitute(this.promptTemplateWithDefault, { 'default': defaultValue, 'prompt': message });
+
+             if (message != newMessage)
+             {
+               widget.set("label", newMessage);
+             }
+           }
+         }
+       }
      },
      _processWidgetValue: function (widget, category, type)
      {

Modified: qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Port.js
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Port.js?rev=1623378&r1=1623377&r2=1623378&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Port.js (original)
+++ qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Port.js Mon Sep  8 12:36:23 2014
@@ -137,6 +137,7 @@ define(["dojo/dom",
                            "needClientAuthValue",
                            "wantClientAuthValue",
                            "trustStoresValue",
+                           "authenticationProvider",
                            "bindingAddress",
                            "keyStore",
                            "needClientAuth",
@@ -183,6 +184,7 @@ define(["dojo/dom",
 
               var typeMetaData = metadata.getMetaData("Port", this.portData["type"]);
 
+              this.authenticationProvider.style.display = "authenticationProvider" in typeMetaData.attributes ? "block" : "none";
               this.bindingAddress.style.display = "bindingAddress" in typeMetaData.attributes ? "block" : "none";
               this.keyStore.style.display = "keyStore" in typeMetaData.attributes ? "block" : "none";
               this.needClientAuth.style.display = "needClientAuth" in typeMetaData.attributes ? "block" : "none";

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=1623378&r1=1623377&r2=1623378&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 Sep  8 12:36:23 2014
@@ -23,7 +23,6 @@ define(["dojo/_base/xhr",
         "dojo/dom-construct",
         "dojo/_base/window",
         "dijit/registry",
-        "dojo/parser",
         "dojo/_base/array",
         "dojo/_base/event",
         'dojo/_base/json',
@@ -56,7 +55,7 @@ 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, metadata) {
+    function (xhr, dom, construct, win, registry, array, event, json, Memory, ObjectStore, FilteringSelect, domStyle, lang, util, metadata) {
 
         var addPort = {};
 
@@ -86,10 +85,18 @@ define(["dojo/_base/xhr",
             var transportsValues = metadata.extractUniqueListOfValues(transportsValidValues);
             util.setMultiSelectOptions(transportsMultiSelect, transportsValues.sort());
 
-            toggleSslWidgets(newValue, transportsMultiSelect.value);
+            addPort._toggleSslWidgets(newValue, transportsMultiSelect.value);
+            util.applyMetadataToWidgets(registry.byId("addPort").domNode, "Port", newValue);
+
         };
 
-        var convertToPort = function convertToPort(formValues)
+        addPort._isSecure = function(currentTransport)
+        {
+          return currentTransport == "SSL" || (lang.isArray(currentTransport) && array.indexOf(currentTransport, "SSL")>=0)
+            || currentTransport == "WSS" || (lang.isArray(currentTransport) && array.indexOf(currentTransport, "WSS")>=0);
+        }
+
+        addPort._convertToPort = function(formValues)
             {
                 var newPort = {};
                 newPort.name = dijit.byId("formAddPort.name").value;
@@ -154,7 +161,7 @@ define(["dojo/_base/xhr",
 
                     var initialTransport = transportWidget.initialValue;
                     var currentTransport = transportWidget.value;
-                    if (currentTransport == "SSL" || (lang.isArray(currentTransport) && array.indexOf(currentTransport, "SSL")>=0))
+                    if (addPort._isSecure(currentTransport))
                     {
                       newPort.needClientAuth = needClientAuth.checked;
                       newPort.wantClientAuth = wantClientAuth.checked
@@ -185,12 +192,12 @@ define(["dojo/_base/xhr",
                 return newPort;
             };
 
-            var toggleSslWidgets = function toggleSslWidgets(portType, transportType)
+        addPort._toggleSslWidgets = function(portType, transportType)
             {
                 var clientAuthPanel = dojo.byId("formAddPort:fieldsClientAuth");
                 var transportSSLPanelNode = dom.byId("formAddPort:fieldsTransportSSL");
 
-                if (transportType == "SSL" || (lang.isArray(transportType) && array.indexOf(transportType, "SSL")>=0))
+                if (addPort._isSecure(transportType))
                 {
                     var typeMetaData = metadata.getMetaData("Port", portType);
                     var clientAuth = "needClientAuth" in typeMetaData.attributes || "wantClientAuth" in typeMetaData.attributes;
@@ -217,67 +224,90 @@ define(["dojo/_base/xhr",
 
             };
 
-            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);
-                });
+        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()
+        {
+          //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");
+            addPort._toggleSslWidgets(portType, newValue);
+          });
+
+          theForm = registry.byId("formAddPort");
+          theForm.on("submit", function (e)
+          {
 
-                theForm = registry.byId("formAddPort");
-                theForm.on("submit", function(e) {
+            event.stop(e);
+            if (theForm.validate())
+            {
 
-                    event.stop(e);
-                    if(theForm.validate()){
+              var newPort = addPort._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);
+              }
 
-                        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;
+              return false;
 
-                        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;
+            }
 
+          });
+        }
 
-                    }else{
-                        alert('Form contains invalid data.  Please correct first');
-                        return false;
-                    }
-
-                });
-            }});
+        addPort.show = function(portName, portType, providers, keystores, truststores)
+        {
 
+            if (!this.formPrepared)
+            {
+              this._prepareForm();
+              this.formPrepared = true;
+            }
 
-        addPort.show = function(portName, portType, providers, keystores, truststores) {
             registry.byId("formAddPort").reset();
             dojo.byId("formAddPort.id").value = "";
 
@@ -371,6 +401,8 @@ define(["dojo/_base/xhr",
 
                        //authenticationProvider
                        providerWidget.set("value", port.authenticationProvider ? port.authenticationProvider : "");
+                       providerWidget.set("disabled", ! ("authenticationProvider" in typeMetaData.attributes));
+                       dom.byId("formAddPort:fieldsAuthenticationProvider").style.display = "authenticationProvider" in typeMetaData.attributes ? "block" : "none";
 
                        //transports
                        var transportsMultiSelect = dom.byId("formAddPort.transports");
@@ -444,5 +476,7 @@ define(["dojo/_base/xhr",
 
         };
 
+        addPort._init();
+
         return addPort;
     });



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