Skip to content

Commit 79e8440

Browse files
committed
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
1 parent 88c521c commit 79e8440

File tree

18 files changed

+337
-16
lines changed

18 files changed

+337
-16
lines changed

qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreFactory.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.util.List;
2626
import java.util.Map;
2727
import org.apache.commons.configuration.Configuration;
28+
import org.apache.qpid.server.model.VirtualHost;
2829
import org.apache.qpid.server.plugin.MessageStoreFactory;
2930
import org.apache.qpid.server.store.MessageStore;
3031

@@ -72,4 +73,15 @@ public Map<String, Object> convertStoreConfiguration(Configuration storeConfigur
7273

7374
}
7475

76+
@Override
77+
public void validateAttributes(Map<String, Object> attributes)
78+
{
79+
Object storePath = attributes.get(VirtualHost.STORE_PATH);
80+
if(!(storePath instanceof String))
81+
{
82+
throw new IllegalArgumentException("Attribute '"+ VirtualHost.STORE_PATH
83+
+"' is required and must be of type String.");
84+
85+
}
86+
}
7587
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
*
3+
* Licensed to the Apache Software Foundation (ASF) under one
4+
* or more contributor license agreements. See the NOTICE file
5+
* distributed with this work for additional information
6+
* regarding copyright ownership. The ASF licenses this file
7+
* to you under the Apache License, Version 2.0 (the
8+
* "License"); you may not use this file except in compliance
9+
* with the License. You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing,
14+
* software distributed under the License is distributed on an
15+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
* KIND, either express or implied. See the License for the
17+
* specific language governing permissions and limitations
18+
* under the License.
19+
*
20+
*/
21+
define(["dojo/_base/xhr",
22+
"dojo/dom",
23+
"dojo/dom-construct",
24+
"dojo/_base/window",
25+
"dijit/registry",
26+
"dojo/parser",
27+
"dojo/_base/array",
28+
"dojo/_base/event",
29+
"dojo/_base/json",
30+
"dojo/string",
31+
"dojo/store/Memory",
32+
"dijit/form/FilteringSelect",
33+
"dojo/domReady!"],
34+
function (xhr, dom, construct, win, registry, parser, array, event, json, string, Memory, FilteringSelect) {
35+
return {
36+
show: function() {
37+
var node = dom.byId("addVirtualHost.storeSpecificDiv");
38+
var that = this;
39+
40+
array.forEach(registry.toArray(),
41+
function(item) {
42+
if(item.id.substr(0,27) == "formAddVirtualHost.specific") {
43+
item.destroyRecursive();
44+
}
45+
});
46+
47+
xhr.get({url: "virtualhost/store/bdb/add.html",
48+
sync: true,
49+
load: function(data) {
50+
node.innerHTML = data;
51+
parser.parse(node);
52+
53+
}});
54+
}
55+
};
56+
});
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<table class="tableContainer-table tableContainer-table-horiz">
2+
<tr>
3+
<td class="tableContainer-labelCell" style="width: 300px;"><strong>Path to store location*: </strong></td>
4+
<td class="tableContainer-valueCell">
5+
<input dojoType="dijit/form/ValidationTextBox" required="true" id="formAddVirtualHost.specific.storePath"
6+
name="storePath" placeholder="/path/to/message/store" />
7+
</td>
8+
</tr>
9+
</table>

qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/standard/addVirtualHost.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@ define(["dojo/_base/xhr",
2626
"dojo/parser",
2727
"dojo/_base/array",
2828
"dojo/_base/event",
29-
'dojo/_base/json',
29+
"dojo/_base/json",
30+
"dojo/string",
3031
"dojo/store/Memory",
3132
"dijit/form/FilteringSelect",
3233
"dojo/domReady!"],
33-
function (xhr, dom, construct, win, registry, parser, array, event, json, Memory, FilteringSelect) {
34+
function (xhr, dom, construct, win, registry, parser, array, event, json, string, Memory, FilteringSelect) {
3435
return {
3536
show: function() {
3637
var node = dom.byId("addVirtualHost.typeSpecificDiv");
@@ -43,6 +44,17 @@ define(["dojo/_base/xhr",
4344
}
4445
});
4546

47+
48+
var selectStoreType = function(type) {
49+
if(type && string.trim(type) != "") {
50+
require(["qpid/management/virtualhost/store/"+type.toLowerCase()+"/add"],
51+
function(storeType)
52+
{
53+
storeType.show();
54+
});
55+
}
56+
}
57+
4658
xhr.get({url: "virtualhost/standard/add.html",
4759
sync: true,
4860
load: function(data) {
@@ -70,7 +82,8 @@ define(["dojo/_base/xhr",
7082
that.storeTypeChooser = new FilteringSelect({ id: "addVirtualHost.specific.storeType",
7183
name: "storeType",
7284
store: storeTypesStore,
73-
searchAttr: "name", required: false}, input);
85+
searchAttr: "name", required: false,
86+
onChange: selectStoreType }, input);
7487
});
7588

7689
}});
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
*
3+
* Licensed to the Apache Software Foundation (ASF) under one
4+
* or more contributor license agreements. See the NOTICE file
5+
* distributed with this work for additional information
6+
* regarding copyright ownership. The ASF licenses this file
7+
* to you under the Apache License, Version 2.0 (the
8+
* "License"); you may not use this file except in compliance
9+
* with the License. You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing,
14+
* software distributed under the License is distributed on an
15+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
* KIND, either express or implied. See the License for the
17+
* specific language governing permissions and limitations
18+
* under the License.
19+
*
20+
*/
21+
define(["dojo/_base/xhr",
22+
"dojo/dom",
23+
"dojo/dom-construct",
24+
"dojo/_base/window",
25+
"dijit/registry",
26+
"dojo/parser",
27+
"dojo/_base/array",
28+
"dojo/_base/event",
29+
"dojo/_base/json",
30+
"dojo/string",
31+
"dojo/store/Memory",
32+
"dijit/form/FilteringSelect",
33+
"dojo/domReady!"],
34+
function (xhr, dom, construct, win, registry, parser, array, event, json, string, Memory, FilteringSelect) {
35+
return {
36+
show: function() {
37+
var node = dom.byId("addVirtualHost.storeSpecificDiv");
38+
var that = this;
39+
40+
array.forEach(registry.toArray(),
41+
function(item) {
42+
if(item.id.substr(0,27) == "formAddVirtualHost.specific") {
43+
item.destroyRecursive();
44+
}
45+
});
46+
47+
xhr.get({url: "virtualhost/store/derby/add.html",
48+
sync: true,
49+
load: function(data) {
50+
node.innerHTML = data;
51+
parser.parse(node);
52+
53+
}});
54+
}
55+
};
56+
});
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
*
3+
* Licensed to the Apache Software Foundation (ASF) under one
4+
* or more contributor license agreements. See the NOTICE file
5+
* distributed with this work for additional information
6+
* regarding copyright ownership. The ASF licenses this file
7+
* to you under the Apache License, Version 2.0 (the
8+
* "License"); you may not use this file except in compliance
9+
* with the License. You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing,
14+
* software distributed under the License is distributed on an
15+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
* KIND, either express or implied. See the License for the
17+
* specific language governing permissions and limitations
18+
* under the License.
19+
*
20+
*/
21+
define(["dojo/_base/xhr",
22+
"dojo/dom",
23+
"dojo/dom-construct",
24+
"dojo/_base/window",
25+
"dijit/registry",
26+
"dojo/parser",
27+
"dojo/_base/array",
28+
"dojo/_base/event",
29+
"dojo/_base/json",
30+
"dojo/string",
31+
"dojo/store/Memory",
32+
"dijit/form/FilteringSelect",
33+
"dojo/domReady!"],
34+
function (xhr, dom, construct, win, registry, parser, array, event, json, string, Memory, FilteringSelect) {
35+
return {
36+
show: function() {
37+
var node = dom.byId("addVirtualHost.storeSpecificDiv");
38+
var that = this;
39+
40+
array.forEach(registry.toArray(),
41+
function(item) {
42+
if(item.id.substr(0,27) == "formAddVirtualHost.specific") {
43+
item.destroyRecursive();
44+
}
45+
});
46+
47+
xhr.get({url: "virtualhost/store/jdbc/add.html",
48+
sync: true,
49+
load: function(data) {
50+
node.innerHTML = data;
51+
parser.parse(node);
52+
53+
}});
54+
}
55+
};
56+
});
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
*
3+
* Licensed to the Apache Software Foundation (ASF) under one
4+
* or more contributor license agreements. See the NOTICE file
5+
* distributed with this work for additional information
6+
* regarding copyright ownership. The ASF licenses this file
7+
* to you under the Apache License, Version 2.0 (the
8+
* "License"); you may not use this file except in compliance
9+
* with the License. You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing,
14+
* software distributed under the License is distributed on an
15+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
* KIND, either express or implied. See the License for the
17+
* specific language governing permissions and limitations
18+
* under the License.
19+
*
20+
*/
21+
define(["dojo/_base/xhr",
22+
"dojo/dom",
23+
"dojo/dom-construct",
24+
"dojo/_base/window",
25+
"dijit/registry",
26+
"dojo/parser",
27+
"dojo/_base/array",
28+
"dojo/_base/event",
29+
"dojo/_base/json",
30+
"dojo/string",
31+
"dojo/store/Memory",
32+
"dijit/form/FilteringSelect",
33+
"dojo/domReady!"],
34+
function (xhr, dom, construct, win, registry, parser, array, event, json, string, Memory, FilteringSelect) {
35+
return {
36+
show: function() {
37+
var node = dom.byId("addVirtualHost.storeSpecificDiv");
38+
var that = this;
39+
40+
array.forEach(registry.toArray(),
41+
function(item) {
42+
if(item.id.substr(0,27) == "formAddVirtualHost.specific") {
43+
item.destroyRecursive();
44+
}
45+
});
46+
47+
xhr.get({url: "virtualhost/store/memory/add.html",
48+
sync: true,
49+
load: function(data) {
50+
node.innerHTML = data;
51+
parser.parse(node);
52+
53+
}});
54+
}
55+
};
56+
});

qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/standard/add.html

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
<td class="tableContainer-labelCell" style="width: 300px;"><strong>Store Type*: </strong></td>
44
<td class="tableContainer-valueCell" ><div id="addVirtualHost.specific.selectStoreType"></div></td>
55
</tr>
6-
<tr>
7-
<td class="tableContainer-labelCell" style="width: 300px;"><strong>Path to store location*: </strong></td>
8-
<td class="tableContainer-valueCell">
9-
<input dojoType="dijit/form/ValidationTextBox" required="true" id="formAddVirtualHost.specific.storePath"
10-
name="storePath" placeholder="/path/to/message/store" />
11-
</td>
12-
</tr>
136
</table>
7+
<div id="addVirtualHost.storeSpecificDiv">
8+
</div>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<table class="tableContainer-table tableContainer-table-horiz">
2+
<tr>
3+
<td class="tableContainer-labelCell" style="width: 300px;"><strong>Path to store location*: </strong></td>
4+
<td class="tableContainer-valueCell">
5+
<input dojoType="dijit/form/ValidationTextBox" required="true" id="formAddVirtualHost.specific.storePath"
6+
name="storePath" placeholder="/path/to/message/store" />
7+
</td>
8+
</tr>
9+
</table>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<table class="tableContainer-table tableContainer-table-horiz">
2+
<tr>
3+
<td class="tableContainer-labelCell" style="width: 300px;"><strong>JDBC Url*: </strong></td>
4+
<td class="tableContainer-valueCell">
5+
<input dojoType="dijit/form/ValidationTextBox" required="true" id="formAddVirtualHost.specific.connectionURL"
6+
name="connectionURL" placeholder="jdbc:provider:info" />
7+
</td>
8+
</tr>
9+
</table>

0 commit comments

Comments
 (0)