summaryrefslogtreecommitdiff
path: root/qpid/java
diff options
context:
space:
mode:
authorKeith Wall <kwall@apache.org>2014-12-28 19:26:55 +0000
committerKeith Wall <kwall@apache.org>2014-12-28 19:26:55 +0000
commitb0175c7154a5025c0e98c7fff7d3a59f5fb4a405 (patch)
treea018d1493b43caf48c697f4fe4c327f64cdba1bb /qpid/java
parentf8f58ec7e1e5517ff0a3ecc25248fa636b67a393 (diff)
downloadqpid-python-b0175c7154a5025c0e98c7fff7d3a59f5fb4a405.tar.gz
QPID-6290: [Java Broker] Management UI - refactor add VHN/VH to remove type based conditional logic
* Also removed now defunct Broker attributes #supportedVirtualHostNodeTypes and #supportedVirtualHostTypes git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1648245 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java7
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/BrokerModel.java1
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerAdapter.java12
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java2
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/metadata.js6
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js78
-rw-r--r--qpid/java/systests/src/test/java/org/apache/qpid/systest/rest/BrokerRestTest.java3
7 files changed, 26 insertions, 83 deletions
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java
index 9f15b234c3..0859be7381 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java
@@ -40,8 +40,6 @@ public interface Broker<X extends Broker<X>> extends ConfiguredObject<X>, EventL
String PLATFORM = "platform";
String PROCESS_PID = "processPid";
String PRODUCT_VERSION = "productVersion";
- String SUPPORTED_VIRTUALHOST_TYPES = "supportedVirtualHostTypes";
- String SUPPORTED_VIRTUALHOSTNODE_TYPES = "supportedVirtualHostNodeTypes";
String SUPPORTED_AUTHENTICATION_PROVIDERS = "supportedAuthenticationProviders";
String SUPPORTED_PREFERENCES_PROVIDER_TYPES = "supportedPreferencesProviderTypes";
String DEFAULT_VIRTUAL_HOST = "defaultVirtualHost";
@@ -110,8 +108,6 @@ public interface Broker<X extends Broker<X>> extends ConfiguredObject<X>, EventL
@DerivedAttribute
String getProductVersion();
- @DerivedAttribute
- Collection<String> getSupportedVirtualHostNodeTypes();
@DerivedAttribute
Collection<String> getSupportedAuthenticationProviders();
@@ -119,9 +115,6 @@ public interface Broker<X extends Broker<X>> extends ConfiguredObject<X>, EventL
@DerivedAttribute
Collection<String> getSupportedPreferencesProviderTypes();
- @DerivedAttribute
- Collection<String> getSupportedVirtualHostTypes();
-
@ManagedAttribute
String getDefaultVirtualHost();
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/BrokerModel.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/BrokerModel.java
index a1cbb0fc15..8d7033677f 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/BrokerModel.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/BrokerModel.java
@@ -42,6 +42,7 @@ public final class BrokerModel extends Model
* 1.3 Truststore/Keystore type => trustStoreType / type => keyStoreType
* 1.4 Separate messageStoreSettings from virtualhost
* 2.0 Introduce VirtualHostNode as a child of a Broker instead of VirtualHost
+ * 2.1 Add VH aliases; remove Broker#supportedVirtualHostNodeTypes and #supportedVirtualHostTypes
*/
public static final int MODEL_MAJOR_VERSION = 2;
public static final int MODEL_MINOR_VERSION = 1;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerAdapter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerAdapter.java
index 13182cb93e..fcaf5a690c 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerAdapter.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerAdapter.java
@@ -327,18 +327,6 @@ public class BrokerAdapter extends AbstractConfiguredObject<BrokerAdapter> imple
}
@Override
- public Collection<String> getSupportedVirtualHostNodeTypes()
- {
- return getObjectFactory().getSupportedTypes(VirtualHostNode.class);
- }
-
- @Override
- public Collection<String> getSupportedVirtualHostTypes()
- {
- return getObjectFactory().getSupportedTypes(VirtualHost.class);
- }
-
- @Override
public Collection<String> getSupportedAuthenticationProviders()
{
return getObjectFactory().getSupportedTypes(AuthenticationProvider.class);
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java
index 1e795480fc..9460c7a64e 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java
+++ b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java
@@ -54,8 +54,6 @@ public class HelperServlet extends AbstractServlet
_mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
Action[] supportedActions = {
- new ListBrokerAttribute(Broker.SUPPORTED_VIRTUALHOSTNODE_TYPES, "ListVirtualHostNodeTypes"),
- new ListBrokerAttribute(Broker.SUPPORTED_VIRTUALHOST_TYPES, "ListVirtualHostTypes"),
new ListBrokerAttribute(Broker.SUPPORTED_PREFERENCES_PROVIDER_TYPES, "ListPreferencesProvidersTypes"),
new ListBrokerAttribute(Broker.PRODUCT_VERSION, "version"),
new ListGroupProviderAttributes(),
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/metadata.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/metadata.js
index 749b9b89cb..c62ba5d5d4 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/metadata.js
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/metadata.js
@@ -69,7 +69,13 @@ define(["dojo/_base/xhr",
implementsManagedInterface: function (category, type, managedInterfaceName)
{
return this.getMetaData(category, type).managedInterfaces.indexOf(managedInterfaceName) >= 0;
+ },
+ validChildTypes: function (category, type, childCategory)
+ {
+ var metaData = this.getMetaData(category, type);
+ return metaData ? metaData.validChildTypes[childCategory] : [];
}
+
};
metadata._init();
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js
index b54d7bb778..f379361a09 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js
@@ -90,24 +90,15 @@ define(["dojo/_base/xhr",
this.virtualHostType.set("disabled", true);
- this.supportedVirtualHostNodeTypes = metadata.getTypesForCategory("VirtualHostNode");
- this.supportedVirtualHostNodeTypes.sort();
- this.supportedVirtualHostTypes = metadata.getTypesForCategory("VirtualHost");
- this.supportedVirtualHostTypes.sort();
-
- //VH Type BDB_HA_REPLICA is not user creatable. This is only needed until we have model meta data available.
- this.supportedVirtualHostTypes = array.filter(this.supportedVirtualHostTypes, function(item){
- return item != "BDB_HA_REPLICA" && item != "BDB_HA";
- });
+ var supportedVirtualHostNodeTypes = metadata.getTypesForCategory("VirtualHostNode");
+ supportedVirtualHostNodeTypes.sort();
- var virtualHostNodeTypeStore = util.makeTypeStore(this.supportedVirtualHostNodeTypes);
+ var virtualHostNodeTypeStore = util.makeTypeStore(supportedVirtualHostNodeTypes);
this.virtualHostNodeType.set("store", virtualHostNodeTypeStore);
this.virtualHostNodeType.set("disabled", false);
this.virtualHostNodeType.on("change", function(type){that._vhnTypeChanged(type, that.virtualHostNodeTypeFieldsContainer, "qpid/management/virtualhostnode/");});
- this.virtualHostTypeStore = util.makeTypeStore(this.supportedVirtualHostTypes);
- this.virtualHostType.set("store", this.virtualHostTypeStore);
- this.virtualHostType.set("disabled", false);
+ this.virtualHostType.set("disabled", true);
this.virtualHostType.on("change", function(type){that._vhTypeChanged(type, that.virtualHostTypeFieldsContainer, "qpid/management/virtualhost/");});
if (this.reader)
@@ -191,8 +182,21 @@ define(["dojo/_base/xhr",
},
_vhnTypeChanged: function (type, typeFieldsContainer, urlStem)
{
- this._processDropDownsForBdbHa(type);
- this._processDropDownsForJson(type);
+ var validChildTypes = metadata.validChildTypes("VirtualHostNode", type, "VirtualHost");
+ validChildTypes.sort();
+
+ var virtualHostTypeStore = util.makeTypeStore( validChildTypes );
+
+ this.virtualHostType.set("store", virtualHostTypeStore);
+ this.virtualHostType.set("disabled", validChildTypes.length <= 1);
+ if (validChildTypes.length == 1)
+ {
+ this.virtualHostType.set("value", validChildTypes[0]);
+ }
+ else
+ {
+ this.virtualHostType.reset();
+ }
var vhnTypeSelected = !(type == '');
this.virtualHostNodeUploadFields.style.display = vhnTypeSelected ? "block" : "none";
@@ -272,50 +276,6 @@ define(["dojo/_base/xhr",
this.addButton.set("disabled", false);
this.virtualHostNodeSelectedFileStatusContainer.className = "loadedIcon";
},
- _processDropDownsForBdbHa: function (type)
- {
- if (type == "BDB_HA")
- {
- this.virtualHostType.set("disabled", true);
- if (!this.virtualHostTypeStore.get("BDB_HA"))
- {
- this.virtualHostTypeStore.add({id: "BDB_HA", name: "BDB_HA"});
- }
- this.virtualHostType.set("value", "BDB_HA");
- }
- else
- {
- if (this.virtualHostTypeStore.get("BDB_HA"))
- {
- this.virtualHostTypeStore.remove("BDB_HA");
- }
- this.virtualHostType.set("value", "");
-
- this.virtualHostType.set("disabled", false);
- }
- },
- _processDropDownsForJson: function (type)
- {
- if (type == "JSON")
- {
- if (this.virtualHostType.value == "ProvidedStore")
- {
- this.virtualHostType.set("value", "");
- }
-
- if (this.virtualHostTypeStore.get("ProvidedStore"))
- {
- this.virtualHostTypeStore.remove("ProvidedStore");
- }
- }
- else
- {
- if (!this.virtualHostTypeStore.get("ProvidedStore"))
- {
- this.virtualHostTypeStore.add({id: "ProvidedStore", name: "ProvidedStore"});
- }
- }
- },
_cancel: function(e)
{
if (this.reader)
diff --git a/qpid/java/systests/src/test/java/org/apache/qpid/systest/rest/BrokerRestTest.java b/qpid/java/systests/src/test/java/org/apache/qpid/systest/rest/BrokerRestTest.java
index ba95eecc6d..4023830a8d 100644
--- a/qpid/java/systests/src/test/java/org/apache/qpid/systest/rest/BrokerRestTest.java
+++ b/qpid/java/systests/src/test/java/org/apache/qpid/systest/rest/BrokerRestTest.java
@@ -235,9 +235,6 @@ public class BrokerRestTest extends QpidRestTestCase
assertNotNull("Unexpected value of attribute ports", brokerDetails.get(BROKER_PORTS_ATTRIBUTE));
assertNotNull("Unexpected value of attribute authenticationproviders", brokerDetails.get(BROKER_AUTHENTICATIONPROVIDERS_ATTRIBUTE));
- assertNotNull("Unexpected value of attribute supportedVirtualHostTypes", brokerDetails.get(Broker.SUPPORTED_VIRTUALHOST_TYPES));
- assertNotNull("Unexpected value of attribute supportedVirtualHostNodeTypes", brokerDetails.get(Broker.SUPPORTED_VIRTUALHOSTNODE_TYPES));
-
}
}