summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Godfrey <rgodfrey@apache.org>2013-07-05 20:59:00 +0000
committerRobert Godfrey <rgodfrey@apache.org>2013-07-05 20:59:00 +0000
commit79e8440bdaac4a4dd764ace6b81cd300717c7d67 (patch)
tree72be60d2fdd1e78dd4b7d707ac78befddf5efec0
parent88c521cc70189673c259cbccd2f7ea7732a8588a (diff)
downloadqpid-python-79e8440bdaac4a4dd764ace6b81cd300717c7d67.tar.gz
QPID-4980 : [Java Broker] In HTTP Management make (standard) virtual host store attributes depended upon store type
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1500134 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreFactory.java12
-rw-r--r--qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/store/bdb/add.js56
-rw-r--r--qpid/java/bdbstore/src/main/java/resources/virtualhost/store/bdb/add.html9
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/standard/addVirtualHost.js19
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/store/derby/add.js56
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/store/jdbc/add.js56
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/store/memory/add.js56
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/standard/add.html9
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/store/derby/add.html9
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/store/jdbc/add.html9
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/store/memory/add.html0
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/plugin/MessageStoreFactory.java1
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/store/MemoryMessageStoreFactory.java4
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStoreFactory.java14
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStore.java5
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStoreFactory.java18
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHostFactory.java15
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStoreFactory.java5
18 files changed, 337 insertions, 16 deletions
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreFactory.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreFactory.java
index 4d224ab86e..4eac54dd6f 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreFactory.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreFactory.java
@@ -25,6 +25,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.configuration.Configuration;
+import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.plugin.MessageStoreFactory;
import org.apache.qpid.server.store.MessageStore;
@@ -72,4 +73,15 @@ public class BDBMessageStoreFactory implements MessageStoreFactory
}
+ @Override
+ public void validateAttributes(Map<String, Object> attributes)
+ {
+ Object storePath = attributes.get(VirtualHost.STORE_PATH);
+ if(!(storePath instanceof String))
+ {
+ throw new IllegalArgumentException("Attribute '"+ VirtualHost.STORE_PATH
+ +"' is required and must be of type String.");
+
+ }
+ }
}
diff --git a/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/store/bdb/add.js b/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/store/bdb/add.js
new file mode 100644
index 0000000000..b86a2c73d4
--- /dev/null
+++ b/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/store/bdb/add.js
@@ -0,0 +1,56 @@
+/*
+ *
+ * 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.
+ *
+ */
+define(["dojo/_base/xhr",
+ "dojo/dom",
+ "dojo/dom-construct",
+ "dojo/_base/window",
+ "dijit/registry",
+ "dojo/parser",
+ "dojo/_base/array",
+ "dojo/_base/event",
+ "dojo/_base/json",
+ "dojo/string",
+ "dojo/store/Memory",
+ "dijit/form/FilteringSelect",
+ "dojo/domReady!"],
+ function (xhr, dom, construct, win, registry, parser, array, event, json, string, Memory, FilteringSelect) {
+ return {
+ show: function() {
+ var node = dom.byId("addVirtualHost.storeSpecificDiv");
+ var that = this;
+
+ array.forEach(registry.toArray(),
+ function(item) {
+ if(item.id.substr(0,27) == "formAddVirtualHost.specific") {
+ item.destroyRecursive();
+ }
+ });
+
+ xhr.get({url: "virtualhost/store/bdb/add.html",
+ sync: true,
+ load: function(data) {
+ node.innerHTML = data;
+ parser.parse(node);
+
+ }});
+ }
+ };
+ });
diff --git a/qpid/java/bdbstore/src/main/java/resources/virtualhost/store/bdb/add.html b/qpid/java/bdbstore/src/main/java/resources/virtualhost/store/bdb/add.html
new file mode 100644
index 0000000000..9424612e3c
--- /dev/null
+++ b/qpid/java/bdbstore/src/main/java/resources/virtualhost/store/bdb/add.html
@@ -0,0 +1,9 @@
+<table class="tableContainer-table tableContainer-table-horiz">
+ <tr>
+ <td class="tableContainer-labelCell" style="width: 300px;"><strong>Path to store location*: </strong></td>
+ <td class="tableContainer-valueCell">
+ <input dojoType="dijit/form/ValidationTextBox" required="true" id="formAddVirtualHost.specific.storePath"
+ name="storePath" placeholder="/path/to/message/store" />
+ </td>
+ </tr>
+</table>
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/standard/addVirtualHost.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/standard/addVirtualHost.js
index cd56ca9cba..164e118e09 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/standard/addVirtualHost.js
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/standard/addVirtualHost.js
@@ -26,11 +26,12 @@ define(["dojo/_base/xhr",
"dojo/parser",
"dojo/_base/array",
"dojo/_base/event",
- 'dojo/_base/json',
+ "dojo/_base/json",
+ "dojo/string",
"dojo/store/Memory",
"dijit/form/FilteringSelect",
"dojo/domReady!"],
- function (xhr, dom, construct, win, registry, parser, array, event, json, Memory, FilteringSelect) {
+ function (xhr, dom, construct, win, registry, parser, array, event, json, string, Memory, FilteringSelect) {
return {
show: function() {
var node = dom.byId("addVirtualHost.typeSpecificDiv");
@@ -43,6 +44,17 @@ define(["dojo/_base/xhr",
}
});
+
+ var selectStoreType = function(type) {
+ if(type && string.trim(type) != "") {
+ require(["qpid/management/virtualhost/store/"+type.toLowerCase()+"/add"],
+ function(storeType)
+ {
+ storeType.show();
+ });
+ }
+ }
+
xhr.get({url: "virtualhost/standard/add.html",
sync: true,
load: function(data) {
@@ -70,7 +82,8 @@ define(["dojo/_base/xhr",
that.storeTypeChooser = new FilteringSelect({ id: "addVirtualHost.specific.storeType",
name: "storeType",
store: storeTypesStore,
- searchAttr: "name", required: false}, input);
+ searchAttr: "name", required: false,
+ onChange: selectStoreType }, input);
});
}});
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/store/derby/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/store/derby/add.js
new file mode 100644
index 0000000000..a17561d7ed
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/store/derby/add.js
@@ -0,0 +1,56 @@
+/*
+ *
+ * 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.
+ *
+ */
+define(["dojo/_base/xhr",
+ "dojo/dom",
+ "dojo/dom-construct",
+ "dojo/_base/window",
+ "dijit/registry",
+ "dojo/parser",
+ "dojo/_base/array",
+ "dojo/_base/event",
+ "dojo/_base/json",
+ "dojo/string",
+ "dojo/store/Memory",
+ "dijit/form/FilteringSelect",
+ "dojo/domReady!"],
+ function (xhr, dom, construct, win, registry, parser, array, event, json, string, Memory, FilteringSelect) {
+ return {
+ show: function() {
+ var node = dom.byId("addVirtualHost.storeSpecificDiv");
+ var that = this;
+
+ array.forEach(registry.toArray(),
+ function(item) {
+ if(item.id.substr(0,27) == "formAddVirtualHost.specific") {
+ item.destroyRecursive();
+ }
+ });
+
+ xhr.get({url: "virtualhost/store/derby/add.html",
+ sync: true,
+ load: function(data) {
+ node.innerHTML = data;
+ parser.parse(node);
+
+ }});
+ }
+ };
+ });
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/store/jdbc/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/store/jdbc/add.js
new file mode 100644
index 0000000000..2b5f1f2053
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/store/jdbc/add.js
@@ -0,0 +1,56 @@
+/*
+ *
+ * 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.
+ *
+ */
+define(["dojo/_base/xhr",
+ "dojo/dom",
+ "dojo/dom-construct",
+ "dojo/_base/window",
+ "dijit/registry",
+ "dojo/parser",
+ "dojo/_base/array",
+ "dojo/_base/event",
+ "dojo/_base/json",
+ "dojo/string",
+ "dojo/store/Memory",
+ "dijit/form/FilteringSelect",
+ "dojo/domReady!"],
+ function (xhr, dom, construct, win, registry, parser, array, event, json, string, Memory, FilteringSelect) {
+ return {
+ show: function() {
+ var node = dom.byId("addVirtualHost.storeSpecificDiv");
+ var that = this;
+
+ array.forEach(registry.toArray(),
+ function(item) {
+ if(item.id.substr(0,27) == "formAddVirtualHost.specific") {
+ item.destroyRecursive();
+ }
+ });
+
+ xhr.get({url: "virtualhost/store/jdbc/add.html",
+ sync: true,
+ load: function(data) {
+ node.innerHTML = data;
+ parser.parse(node);
+
+ }});
+ }
+ };
+ });
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/store/memory/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/store/memory/add.js
new file mode 100644
index 0000000000..010242cb9b
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/store/memory/add.js
@@ -0,0 +1,56 @@
+/*
+ *
+ * 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.
+ *
+ */
+define(["dojo/_base/xhr",
+ "dojo/dom",
+ "dojo/dom-construct",
+ "dojo/_base/window",
+ "dijit/registry",
+ "dojo/parser",
+ "dojo/_base/array",
+ "dojo/_base/event",
+ "dojo/_base/json",
+ "dojo/string",
+ "dojo/store/Memory",
+ "dijit/form/FilteringSelect",
+ "dojo/domReady!"],
+ function (xhr, dom, construct, win, registry, parser, array, event, json, string, Memory, FilteringSelect) {
+ return {
+ show: function() {
+ var node = dom.byId("addVirtualHost.storeSpecificDiv");
+ var that = this;
+
+ array.forEach(registry.toArray(),
+ function(item) {
+ if(item.id.substr(0,27) == "formAddVirtualHost.specific") {
+ item.destroyRecursive();
+ }
+ });
+
+ xhr.get({url: "virtualhost/store/memory/add.html",
+ sync: true,
+ load: function(data) {
+ node.innerHTML = data;
+ parser.parse(node);
+
+ }});
+ }
+ };
+ });
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/standard/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/standard/add.html
index 9596ef4175..3519d0dbd6 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/standard/add.html
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/standard/add.html
@@ -3,11 +3,6 @@
<td class="tableContainer-labelCell" style="width: 300px;"><strong>Store Type*: </strong></td>
<td class="tableContainer-valueCell" ><div id="addVirtualHost.specific.selectStoreType"></div></td>
</tr>
- <tr>
- <td class="tableContainer-labelCell" style="width: 300px;"><strong>Path to store location*: </strong></td>
- <td class="tableContainer-valueCell">
- <input dojoType="dijit/form/ValidationTextBox" required="true" id="formAddVirtualHost.specific.storePath"
- name="storePath" placeholder="/path/to/message/store" />
- </td>
- </tr>
</table>
+<div id="addVirtualHost.storeSpecificDiv">
+</div>
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/store/derby/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/store/derby/add.html
new file mode 100644
index 0000000000..9424612e3c
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/store/derby/add.html
@@ -0,0 +1,9 @@
+<table class="tableContainer-table tableContainer-table-horiz">
+ <tr>
+ <td class="tableContainer-labelCell" style="width: 300px;"><strong>Path to store location*: </strong></td>
+ <td class="tableContainer-valueCell">
+ <input dojoType="dijit/form/ValidationTextBox" required="true" id="formAddVirtualHost.specific.storePath"
+ name="storePath" placeholder="/path/to/message/store" />
+ </td>
+ </tr>
+</table>
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/store/jdbc/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/store/jdbc/add.html
new file mode 100644
index 0000000000..f0a091ea4e
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/store/jdbc/add.html
@@ -0,0 +1,9 @@
+<table class="tableContainer-table tableContainer-table-horiz">
+ <tr>
+ <td class="tableContainer-labelCell" style="width: 300px;"><strong>JDBC Url*: </strong></td>
+ <td class="tableContainer-valueCell">
+ <input dojoType="dijit/form/ValidationTextBox" required="true" id="formAddVirtualHost.specific.connectionURL"
+ name="connectionURL" placeholder="jdbc:provider:info" />
+ </td>
+ </tr>
+</table>
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/store/memory/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/store/memory/add.html
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/store/memory/add.html
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/plugin/MessageStoreFactory.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/plugin/MessageStoreFactory.java
index 9297f34f94..e5e214227a 100644
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/plugin/MessageStoreFactory.java
+++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/plugin/MessageStoreFactory.java
@@ -32,4 +32,5 @@ public interface MessageStoreFactory
public Map<String, Object> convertStoreConfiguration(Configuration configuration);
+ void validateAttributes(Map<String, Object> attributes);
}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/MemoryMessageStoreFactory.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/store/MemoryMessageStoreFactory.java
index 476b2f127d..49f823e7ee 100644
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/MemoryMessageStoreFactory.java
+++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/store/MemoryMessageStoreFactory.java
@@ -46,4 +46,8 @@ public class MemoryMessageStoreFactory implements MessageStoreFactory
return Collections.emptyMap();
}
+ @Override
+ public void validateAttributes(Map<String, Object> attributes)
+ {
+ }
}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStoreFactory.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStoreFactory.java
index 0f53d66435..1b111ad65e 100644
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStoreFactory.java
+++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStoreFactory.java
@@ -23,6 +23,7 @@ package org.apache.qpid.server.store.derby;
import java.util.Collections;
import java.util.Map;
import org.apache.commons.configuration.Configuration;
+import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.plugin.MessageStoreFactory;
import org.apache.qpid.server.store.MessageStore;
@@ -47,4 +48,17 @@ public class DerbyMessageStoreFactory implements MessageStoreFactory
return Collections.emptyMap();
}
+
+ @Override
+ public void validateAttributes(Map<String, Object> attributes)
+ {
+ Object storePath = attributes.get(VirtualHost.STORE_PATH);
+ if(!(storePath instanceof String))
+ {
+ throw new IllegalArgumentException("Attribute '"+ VirtualHost.STORE_PATH
+ +"' is required and must be of type String.");
+
+ }
+ }
+
}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStore.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStore.java
index 951ea28c20..f8d93536bb 100644
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStore.java
+++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStore.java
@@ -50,6 +50,7 @@ public class JDBCMessageStore extends AbstractJDBCMessageStore implements Messag
public static final String TYPE = "JDBC";
+ public static final String CONNECTION_URL = "connectionURL";
protected String _connectionURL;
private ConnectionProvider _connectionProvider;
@@ -280,9 +281,9 @@ public class JDBCMessageStore extends AbstractJDBCMessageStore implements Messag
{
- String connectionURL = virtualHost.getAttribute("connectionURL") == null
+ String connectionURL = virtualHost.getAttribute(CONNECTION_URL) == null
? String.valueOf(virtualHost.getAttribute(VirtualHost.STORE_PATH))
- : String.valueOf(virtualHost.getAttribute("connectionURL"));
+ : String.valueOf(virtualHost.getAttribute(CONNECTION_URL));
JDBCDetails details = null;
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStoreFactory.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStoreFactory.java
index 99ec4c7d32..82d2275156 100644
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStoreFactory.java
+++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStoreFactory.java
@@ -23,6 +23,7 @@ package org.apache.qpid.server.store.jdbc;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.configuration.Configuration;
+import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.plugin.MessageStoreFactory;
import org.apache.qpid.server.store.MessageStore;
@@ -62,4 +63,21 @@ public class JDBCMessageStoreFactory implements MessageStoreFactory
return convertedMap;
}
+
+ @Override
+ public void validateAttributes(Map<String, Object> attributes)
+ {
+ Object connectionURL = attributes.get(JDBCMessageStore.CONNECTION_URL);
+ if(!(connectionURL instanceof String))
+ {
+ Object storePath = attributes.get(VirtualHost.STORE_PATH);
+ if(!(storePath instanceof String))
+ {
+ throw new IllegalArgumentException("Attribute '"+ JDBCMessageStore.CONNECTION_URL
+ +"' is required and must be of type String.");
+
+ }
+ }
+ }
+
}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHostFactory.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHostFactory.java
index a0f22aa34c..2b4cc37814 100644
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHostFactory.java
+++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHostFactory.java
@@ -58,8 +58,8 @@ public class StandardVirtualHostFactory implements VirtualHostFactory
}
- private static final String STORE_TYPE_ATTRIBUTE = org.apache.qpid.server.model.VirtualHost.STORE_TYPE;
- private static final String STORE_PATH_ATTRIBUTE = org.apache.qpid.server.model.VirtualHost.STORE_PATH;
+ public static final String STORE_TYPE_ATTRIBUTE = org.apache.qpid.server.model.VirtualHost.STORE_TYPE;
+ public static final String STORE_PATH_ATTRIBUTE = org.apache.qpid.server.model.VirtualHost.STORE_PATH;
@Override
public void validateAttributes(Map<String, Object> attributes)
@@ -82,16 +82,23 @@ public class StandardVirtualHostFactory implements VirtualHostFactory
}
+ for(MessageStoreFactory factory : storeCreator.getFactories())
+ {
+ if(factory.getType().equalsIgnoreCase((String)storeType))
+ {
+ factory.validateAttributes(attributes);
+ }
+ }
// TODO - each store type should validate its own attributes
if(!((String) storeType).equalsIgnoreCase(MemoryMessageStore.TYPE))
{
- Object storePath = attributes.get(STORE_PATH_ATTRIBUTE);
+ /* Object storePath = attributes.get(STORE_PATH_ATTRIBUTE);
if(!(storePath instanceof String))
{
throw new IllegalArgumentException("Attribute '"+ STORE_PATH_ATTRIBUTE
+"' is required and must be of type String.");
- }
+ }*/
}
}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStoreFactory.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStoreFactory.java
index a798e6d50e..80ef79ae71 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStoreFactory.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStoreFactory.java
@@ -75,4 +75,9 @@ public class SlowMessageStoreFactory implements MessageStoreFactory
return convertedMap;
}
+
+ @Override
+ public void validateAttributes(Map<String, Object> attributes)
+ {
+ }
}