|
Author: rgodfrey
Date: Sun Apr 29 20:20:06 2012 New Revision: 1331987 URL: http://svn.apache.org/viewvc?rev=1331987&view=rev Log: NO-JIRA: [Java Config] Improve presentation of management prototype Added: qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/StructureServlet.java qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/footer.js qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/header.js qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/structure.js Modified: qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/org/apache/qpid/server/management/plugin/Management.java qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/broker.html qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/connection.html qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/broker.css qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/common.css qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/connection.css qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/exchange.css qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/queue.css qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/vhost.css qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/exchange.html qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/broker.js qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/common.js qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/connection.js qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/exchange.js qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/queue.js qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/sasl.js qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/vhost.js qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/queue.html qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/vhost.html qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/Attribute.java qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ConfigurationFileApplicationRegistry.java Modified: qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/org/apache/qpid/server/management/plugin/Management.java URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/org/apache/qpid/server/management/plugin/Management.java?rev=1331987&r1=1331986&r2=1331987&view=diff ============================================================================== --- qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/org/apache/qpid/server/management/plugin/Management.java (original) +++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/org/apache/qpid/server/management/plugin/Management.java Sun Apr 29 20:20:06 2012 @@ -27,6 +27,7 @@ import org.apache.qpid.server.management import org.apache.qpid.server.management.plugin.servlet.api.VhostsServlet; import org.apache.qpid.server.management.plugin.servlet.rest.RestServlet; import org.apache.qpid.server.management.plugin.servlet.rest.SaslServlet; +import org.apache.qpid.server.management.plugin.servlet.rest.StructureServlet; import org.apache.qpid.server.model.Binding; import org.apache.qpid.server.model.Broker; import org.apache.qpid.server.model.ConfiguredObject; @@ -72,6 +73,8 @@ public class Management addRestServlet("port", Port.class); addRestServlet("session", VirtualHost.class, Connection.class, Session.class); + _root.addServlet(new ServletHolder(new StructureServlet(_broker)), "/rest/structure"); + _root.addServlet(new ServletHolder(new SaslServlet(_broker)), "/rest/sasl"); _root.addServlet(new ServletHolder(new DefinedFileServlet("queue.html")),"/queue"); Added: qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/StructureServlet.java URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/StructureServlet.java?rev=1331987&view=auto ============================================================================== --- qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/StructureServlet.java (added) +++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/StructureServlet.java Sun Apr 29 20:20:06 2012 @@ -0,0 +1,86 @@ +/** + * 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 + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * 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.management.plugin.servlet.rest; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.*; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.apache.qpid.server.model.Broker; +import org.apache.qpid.server.model.ConfiguredObject; +import org.apache.qpid.server.model.Model; +import org.codehaus.jackson.map.ObjectMapper; +import org.codehaus.jackson.map.SerializationConfig; + +public class StructureServlet extends AbstractServlet +{ + public StructureServlet(Broker broker) + { + super(broker); + } + + @Override + protected void onGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + { + response.setContentType("application/json"); + response.setStatus(HttpServletResponse.SC_OK); + + response.setHeader("Cache-Control","no-cache"); + response.setHeader("Pragma","no-cache"); + response.setDateHeader ("Expires", 0); + + Map<String,Object> structure = generateStructure(getBroker(), Broker.class); + + final PrintWriter writer = response.getWriter(); + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); + mapper.writeValue(writer, structure); + + response.setStatus(HttpServletResponse.SC_OK); + + } + + private Map<String, Object> generateStructure(ConfiguredObject object, Class<? extends ConfiguredObject> clazz) + { + Map<String, Object> structure = new LinkedHashMap<String, Object>(); + structure.put("id", object.getId()); + structure.put("name", object.getName()); + + for(Class<? extends ConfiguredObject> childClass : Model.getChildTypes(clazz)) + { + Collection<? extends ConfiguredObject> children = object.getChildren(childClass); + if(children != null) + { + List<Map<String, Object>> childObjects = new ArrayList<Map<String, Object>>(); + + for(ConfiguredObject child : children) + { + childObjects.add(generateStructure(child, childClass)); + } + + if(!childObjects.isEmpty()) + { + structure.put(childClass.getSimpleName().toLowerCase()+"s",childObjects); + } + } + } + + return structure; + } +} Modified: qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/broker.html URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/broker.html?rev=1331987&r1=1331986&r2=1331987&view=diff ============================================================================== --- qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/broker.html (original) +++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/broker.html Sun Apr 29 20:20:06 2012 @@ -1,4 +1,25 @@ <!DOCTYPE HTML> +<!-- + - + - 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. + - + --> + <html lang="en"> <head> <meta charset="utf-8"> Modified: qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/connection.html URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/connection.html?rev=1331987&r1=1331986&r2=1331987&view=diff ============================================================================== --- qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/connection.html (original) +++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/connection.html Sun Apr 29 20:20:06 2012 @@ -1,4 +1,24 @@ <!DOCTYPE HTML> +<!-- + - + - 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. + - + --> <html lang="en"> <head> <meta charset="utf-8"> @@ -26,6 +46,7 @@ <script> require(["dijit/layout/BorderContainer", "dijit/layout/TabContainer", "dijit/layout/ContentPane", "dijit/TitlePane", "dojo/parser"]); + </script> <script src="/js/common.js"> @@ -34,19 +55,34 @@ </script> <script src="/js/sasl.js"> </script> + <script src="/js/header.js"></script> + <script src="/js/footer.js"></script> + <script src="/js/structure.js"></script> + + <script> + + + require(["dojo/io-query", "dojo/domReady!"], + function(ioQuery){ + var query = dojo.doc.location.search.substr((dojo.doc.location.search[0] === "?" ? 1 : 0)); + var urlQuery = ioQuery.queryToObject(query); + new Header("Virtual Host: "+urlQuery.vhost +"<br/>Connection: "+urlQuery.connection); + }); + + </script> </head> <body class="claro"> - <div id="pageLayout" data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design: 'headline'"> - <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'top'"><div class="header"> - <div class="logo"> - </div> - </div> </div> + <div id="pageLayout" data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design: 'headline', gutters: false"> + <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'top'"><div id="header" class="header"></div> + </div> <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'top'"> <div id="login"></div> </div> - <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'leading'">Leading pane</div> + <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'leading', splitter: true"> + <div id="structure"></div> + </div> <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'center'"> <span style="">Name:</span><span id="name" style="position:absolute; left:6em"></span> <br/> @@ -75,7 +111,7 @@ </div> <!--<div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'trailing'">Trailing pane</div>--> - <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'bottom'">Bottom pane</div> + <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'bottom'"><div id="footer"></div></div> </div> </body> Modified: qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/broker.css URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/broker.css?rev=1331987&r1=1331986&r2=1331987&view=diff ============================================================================== --- qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/broker.css (original) +++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/broker.css Sun Apr 29 20:20:06 2012 @@ -1,3 +1,23 @@ +/* + * + * 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. + * + */ #virtualHosts { width: 560px; height: 110px; Modified: qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/common.css URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/common.css?rev=1331987&r1=1331986&r2=1331987&view=diff ============================================================================== --- qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/common.css (original) +++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/common.css Sun Apr 29 20:20:06 2012 @@ -1,3 +1,23 @@ +/* + * + * 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. + * + */ * { outline: none !important; } @@ -46,9 +66,22 @@ h1 { } .logo { - text-align:center; + text-align:left; + vertical-align: top; font-weight:600; - padding:0 0 0 0; + height: 90px; + padding-left: 200px; + padding-top: 1px; + padding-bottom: 10px; font-size:14px; font-family:"Verdana", cursive; +} + +.footer { + color:#000000; + clear:both; + text-align:center; + font-size:11px; + line-height:17px; + } \ No newline at end of file Modified: qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/connection.css URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/connection.css?rev=1331987&r1=1331986&r2=1331987&view=diff ============================================================================== --- qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/connection.css (original) +++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/connection.css Sun Apr 29 20:20:06 2012 @@ -1,4 +1,23 @@ - +/* + * + * 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. + * + */ #sessions { width: 100%; height: 100px; Modified: qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/exchange.css URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/exchange.css?rev=1331987&r1=1331986&r2=1331987&view=diff ============================================================================== --- qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/exchange.css (original) +++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/exchange.css Sun Apr 29 20:20:06 2012 @@ -1,4 +1,23 @@ - +/* + * + * 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. + * + */ #bindings { width: 100%; height: 100px; Modified: qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/queue.css URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/queue.css?rev=1331987&r1=1331986&r2=1331987&view=diff ============================================================================== --- qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/queue.css (original) +++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/queue.css Sun Apr 29 20:20:06 2012 @@ -1,4 +1,23 @@ - +/* + * + * 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. + * + */ #bindings { width: 100%; height: 100px; Modified: qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/vhost.css URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/vhost.css?rev=1331987&r1=1331986&r2=1331987&view=diff ============================================================================== --- qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/vhost.css (original) +++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/css/vhost.css Sun Apr 29 20:20:06 2012 @@ -1,4 +1,23 @@ - +/* + * + * 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. + * + */ #queues { width: 100%; height: 100px; Modified: qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/exchange.html URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/exchange.html?rev=1331987&r1=1331986&r2=1331987&view=diff ============================================================================== --- qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/exchange.html (original) +++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/exchange.html Sun Apr 29 20:20:06 2012 @@ -1,4 +1,24 @@ <!DOCTYPE HTML> +<!-- + - + - 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. + - + --> <html lang="en"> <head> <meta charset="utf-8"> @@ -34,6 +54,11 @@ </script> <script src="/js/sasl.js"> </script> + + <script src="/js/header.js"></script> + <script src="/js/footer.js"></script> + <script src="/js/structure.js"></script> + <script> require(["dojo/parser", "dojox/validate/us", @@ -54,12 +79,32 @@ "dojo/domReady!"]); // Require the Dialog class - require(["dojo/dom", "dojo/dom-construct", "dijit/registry", "dojo/_base/xhr", "dojo/store/Memory", "dijit/form/FilteringSelect", "dijit/Dialog"], - function(dom, domConstruct, registry, xhr, Memory, FilteringSelect) + require(["dojo/dom", "dojo/dom-construct", "dijit/registry", "dojo/_base/xhr", "dojo/store/Memory", + "dijit/form/FilteringSelect", "dijit/Dialog","dojo/domReady!"], + function(dom, domConstruct, registry, xhr, Memory, FilteringSelect, Dialog) { var thisObj = this; + createBindingDialog = function() + { + var myDialog = + new Dialog({ + title: "Add Binding", + content: "This is the dialog content.", + style: "width:600px;" + }); + + + a = "<h1>Add a new Binding</h1>" + + "<br/>" + + "<form id=\"addBindingForm\" dojoType=\"dijit.form.Form\" method=\"post\">" + + "</form>"; + myDialog.set("content", a); + + myDialog.show(); + }; + // Show the dialog addBindingDialog = function() { @@ -96,25 +141,31 @@ } // Hide the dialog - hideAddBinding = function() { + hideAddBinding = function() + { registry.byId("addBinding").hide(); - } + }; + + var urlQuery = dojo.queryToObject(dojo.doc.location.search.substr((dojo.doc.location.search[0] === "?" ? 1 : 0))); + + new Header("Virtual Host: "+urlQuery.vhost +"<br/>Exchange: "+urlQuery.exchange); }); + + </script> </head> - </head> <body class="claro"> - <div id="pageLayout" data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design: 'headline'"> - <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'top'"><div class="header"> - <div class="logo"> - </div> - </div> </div> + <div id="pageLayout" data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design: 'headline', gutters: false"> + <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'top'"><div id="header" class="header"></div> + </div> <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'top'"> <div id="login"></div> </div> - <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'leading'">Leading pane</div> + <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'leading', splitter: true"> + <div id="structure"></div> + </div> <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'center'"> <span style="">Exchange:</span><span id="name" style="position:absolute; left:6em"></span> <br/> @@ -137,7 +188,7 @@ <br/> <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Bindings'"> <div id="bindings"></div> - <button onclick="addBindingDialog();">Add Binding</button> + <button onclick="createBindingDialog();">Add Binding</button> <div class="dijitHidden"> <div data-dojo-type="dijit.Dialog" style="width:600px;" data-dojo-props="title:'Add Binding'" id="addBinding"> @@ -194,8 +245,7 @@ <br/> </div> - <!--<div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'trailing'">Trailing pane</div>--> - <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'bottom'">Bottom pane</div> + <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'bottom'"><div id="footer"></div></div> </div> </body> Modified: qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/broker.js URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/broker.js?rev=1331987&r1=1331986&r2=1331987&view=diff ============================================================================== --- qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/broker.js (original) +++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/broker.js Sun Apr 29 20:20:06 2012 @@ -1,3 +1,23 @@ +/* + * + * 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. + * + */ var vhostGrid, dataStore, store, vhostStore; var exchangeGrid, exchangeStore, exchangeDataStore; var updateList = new Array(); Modified: qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/common.js URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/common.js?rev=1331987&r1=1331986&r2=1331987&view=diff ============================================================================== --- qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/common.js (original) +++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/common.js Sun Apr 29 20:20:06 2012 @@ -1,3 +1,32 @@ +/* + * + * 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. + * + */ +var updateList = new Array(); + +setInterval(function(){ + for(var i = 0; i < updateList.length; i++) + { + var obj = updateList[i]; + obj.update(); + }}, 5000); + function formatBytes(amount) { Modified: qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/connection.js URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/connection.js?rev=1331987&r1=1331986&r2=1331987&view=diff ============================================================================== --- qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/connection.js (original) +++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/connection.js Sun Apr 29 20:20:06 2012 @@ -1,4 +1,23 @@ -var updateList = new Array(); +/* + * + * 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. + * + */ var bindingsTuple; @@ -50,7 +69,7 @@ require(["dojo/store/JsonRest", { name: "Msgs Rate", field: "msgRate", width: "150px"}, { name: "Bytes Rate", field: "bytesRate", - width: "150px"} + width: "100%"} ]); @@ -159,11 +178,5 @@ require(["dojo/store/JsonRest", connectionUpdater.update(); - setInterval(function(){ - for(var i = 0; i < updateList.length; i++) - { - var obj = updateList[i]; - obj.update(); - }}, 5000); }); Modified: qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/exchange.js URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/exchange.js?rev=1331987&r1=1331986&r2=1331987&view=diff ============================================================================== --- qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/exchange.js (original) +++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/exchange.js Sun Apr 29 20:20:06 2012 @@ -1,4 +1,23 @@ -var updateList = new Array(); +/* + * + * 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. + * + */ var bindingsTuple; @@ -41,7 +60,7 @@ require(["dojo/store/JsonRest", thisObj.exchangeData.bindings, "bindings", [ { name: "Queue", field: "queue", width: "90px"}, { name: "Binding Key", field: "name", width: "120px"}, - { name: "Arguments", field: "argumentString", width: "200px"} + { name: "Arguments", field: "argumentString", width: "100%"} ]); }); @@ -136,11 +155,5 @@ require(["dojo/store/JsonRest", exchangeUpdater.update(); - setInterval(function(){ - for(var i = 0; i < updateList.length; i++) - { - var obj = updateList[i]; - obj.update(); - }}, 5000); }); Added: qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/footer.js URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/footer.js?rev=1331987&view=auto ============================================================================== --- qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/footer.js (added) +++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/footer.js Sun Apr 29 20:20:06 2012 @@ -0,0 +1,36 @@ +/* + * + * 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. + * + */ + + +var footerHTML = "<div class=\"footer\"><p>© 2004-"+ (new Date()).getFullYear() + +" The Apache Software Foundation.<br />Apache Qpid, Qpid, Apache, the Apache feather logo, and the " + +"Apache Qpid project logo are trademarks of The Apache Software Foundation.<br />" + +"All other marks mentioned may be trademarks or registered trademarks of their respective owners." + +"</p></div>"; + +require(["dojo/dom", "dojo/domReady!"], + function(dom) + { + var footerDiv = dom.byId("footer"); + footerDiv.innerHTML = footerHTML; + + }); + Added: qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/header.js URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/header.js?rev=1331987&view=auto ============================================================================== --- qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/header.js (added) +++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/header.js Sun Apr 29 20:20:06 2012 @@ -0,0 +1,38 @@ +/* + * + * 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. + * + */ + + + + +function Header(title) +{ + + var headerHTML = "<div class=\"logo\"><h2>"+title+"</h2></div>"; + + require(["dojo/dom", "dojo/domReady!"], + function(dom) + { + var headerDiv = dom.byId("header"); + headerDiv.innerHTML = headerHTML; + + }); +}; + Modified: qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/queue.js URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/queue.js?rev=1331987&r1=1331986&r2=1331987&view=diff ============================================================================== --- qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/queue.js (original) +++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/queue.js Sun Apr 29 20:20:06 2012 @@ -1,4 +1,23 @@ -var updateList = new Array(); +/* + * + * 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. + * + */ var bindingsTuple; @@ -46,7 +65,7 @@ require(["dojo/store/JsonRest", thisObj.queueData.bindings, "bindings", [ { name: "Exchange", field: "exchange", width: "90px"}, { name: "Binding Key", field: "name", width: "120px"}, - { name: "Arguments", field: "argumentString", width: "200px"} + { name: "Arguments", field: "argumentString", width: "100%"} ]); thisObj.consumersGrid = new UpdatableStore(Observable, Memory, ObjectStore, DataGrid, @@ -56,7 +75,7 @@ require(["dojo/store/JsonRest", { name: "Msgs Rate", field: "msgRate", width: "150px"}, { name: "Bytes Rate", field: "bytesRate", - width: "150px"} + width: "100%"} ]); @@ -205,11 +224,5 @@ require(["dojo/store/JsonRest", queueUpdater.update(); - setInterval(function(){ - for(var i = 0; i < updateList.length; i++) - { - var obj = updateList[i]; - obj.update(); - }}, 5000); }); Modified: qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/sasl.js URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/sasl.js?rev=1331987&r1=1331986&r2=1331987&view=diff ============================================================================== --- qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/sasl.js (original) +++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/sasl.js Sun Apr 29 20:20:06 2012 @@ -1,3 +1,23 @@ +/* + * + * 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. + * + */ require(["dijit/form/DropDownButton", "dijit/TooltipDialog", "dijit/form/TextBox", "dojo/_base/xhr", "dojox/encoding/base64", "dojox/encoding/digests/_base", "dojox/encoding/digests/MD5"]); var button; Added: qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/structure.js URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/structure.js?rev=1331987&view=auto ============================================================================== --- qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/structure.js (added) +++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/structure.js Sun Apr 29 20:20:06 2012 @@ -0,0 +1,374 @@ +/* + * 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. + */ + +if (Array.isArray) +{ + isArray = function (object) + { + return Array.isArray(object); + }; +} +else +{ + isArray = function (object) + { + return object instanceof Array; + }; +} + +function BrokerTreeModel() +{ + this.query = "/rest/structure"; + + this.onChildrenChange = function(parent, children) + { + // fired when the set of children for an object change + }; + + this.onChange = function(object) + { + // fired when the properties of an object change + }; + + this.onDelete = function(object) + { + // fired when an object is deleted + }; + +} + + + +BrokerTreeModel.prototype.buildModel = function(data) +{ + this.model = data; + +}; + +BrokerTreeModel.prototype.updateModel = function(data) +{ + var thisObj = this; + + function checkForChanges(oldData, data) + { + if(oldData.name != data.name) + { + thisObj.onChange(data); + } + + var childChanges = false; + // Iterate over old childTypes, check all are in new + for(var propName in oldData) + { + var oldChildren = oldData[ propName ]; + if(isArray(oldChildren)) + { + + var newChildren = data[ propName ]; + + if(!(newChildren && isArray(newChildren))) + { + childChanges = true; + } + else + { + var subChanges = false; + // iterate over elements in array, make sure in both, in which case recurse + for(var i = 0; i < oldChildren.length; i++) + { + var matched = false; + for(var j = 0; j < newChildren.length; j++) + { + if(oldChildren[i].id == newChildren[j].id) + { + checkForChanges(oldChildren[i], newChildren[j]); + matched = true; + break; + } + } + if(!matched) + { + subChanges = true; + } + } + if(subChanges == true || oldChildren.length != newChildren.length) + { + thisObj.onChildrenChange({ id: data.id+propName, _dummyChild: propName, data: data }, newChildren); + } + } + } + } + + for(var propName in data) + { + var prop = data[ propName ]; + if(isArray(prop)) + { + if(!(oldData[ propName ] && isArray(oldData[propName]))) + { + childChanges = true; + } + } + } + + if(childChanges) + { + var children; + thisObj.getChildren(data, function(theChildren) { children = theChildren }); + thisObj.onChildrenChange(data, children); + } + } + + var oldData = this.model; + this.model = data; + + checkForChanges(oldData, data); +}; + + +BrokerTreeModel.prototype.fetchItemByIdentity = function(id) +{ + function fetchItem(id, data) + { + if(data.id == id) + { + return data; + } + else if(id.indexOf(data.id) == 0) + { + return { id: id, _dummyChild: id.substring(id.length), data: data }; + } + else + { + for(var propName in data) + { + var prop = data[ propName ]; + if(isArray(prop)) + { + for(var i = 0 ; i < prop.length; i++) + { + var item = fetchItem(id, prop[i]); + if( item ) + { + return item; + } + } + } + } + return null; + } + } + + return fetchItem(id, this.model); +}; + +BrokerTreeModel.prototype.getChildren = function(parentItem, onComplete) +{ + if(parentItem._dummyChild) + { + onComplete(parentItem.data[ parentItem._dummyChild ]); + } + else + { + var children = []; + for(var propName in parentItem) + { + var prop = parentItem[ propName ]; + + if(isArray(prop)) + { + children.push({ id: parentItem.id+propName, _dummyChild: propName, data: parentItem }); + } + } + onComplete( children ); + } +}; + +BrokerTreeModel.prototype.getIdentity = function (item) +{ + return item.id; +}; + +BrokerTreeModel.prototype.getLabel = function (item) +{ + if(item) + { + if(item._dummyChild) + { + return item._dummyChild; + } + else + { + return item.name; + } + } +}; + +BrokerTreeModel.prototype.getRoot = function (onItem) +{ + onItem( this.model ); +}; + +BrokerTreeModel.prototype.mayHaveChildren = function (item) +{ + if(item._dummyChild) + { + return true; + } + else + { + for(var propName in item) + { + var prop = item[ propName ]; + if(isArray(prop)) + { + return true; + } + } + return false; + } +}; + +require(["dojo/io-query", "dojo/domReady!"], + function(ioQuery) + { + + BrokerTreeModel.prototype.relocate = function (item) + { + + function findItemDetails(item, details, type, object) + { + if(item.id == object.id) + { + details.type = type; + details[ type ] = object.name; + } + else + { + details[ type ] = object.name; + + // iterate over children + for(var propName in object) + { + var prop = object[ propName ]; + if(isArray(prop)) + { + for(var i = 0 ; i < prop.length; i++) + { + findItemDetails(item, details, propName.substring(0, propName.length-1),prop[i]) + + if(details.type) + { + break; + } + } + } + if(details.type) + { + break; + } + } + + + + if(!details.type) + { + details[ type ] = null; + } + } + } + + var details = new Object(); + + findItemDetails(item, details, "broker", this.model); + + var uri; + + + if(details.type == "virtualhost") + { + uri = "/vhost?" + ioQuery.objectToQuery({ vhost: details.virtualhost }); + } + else if(details.type == "exchange") + { + uri = "/exchange?" + ioQuery.objectToQuery({ vhost: details.virtualhost , exchange: details.exchange }); + } + else if(details.type == "queue") + { + uri = "/queue?" + ioQuery.objectToQuery({ vhost: details.virtualhost , queue: details.queue}); + } + else if(details.type == "connection") + { + uri = "/connection?" + ioQuery.objectToQuery({ vhost: details.virtualhost , connection: details.connection}); + } + else if(details.type == 'port') + { + uri = "/port?" + ioQuery.objectToQuery({ port: details.port}); + } + + if(uri) + { + window.location = uri; + } + }; + }); + +var structure; + +require(["dojo/_base/xhr", "dojo/domReady!"], + function(xhr) + { + + + BrokerTreeModel.prototype.update = function() + { + var thisObj = this; + + xhr.get({url: this.query, handleAs: "json"}) + .then(function(data) + { + if(thisObj.model) + { + thisObj.updateModel(data); + } + else + { + thisObj.buildModel(data); + } + }); + + } + + structure = new BrokerTreeModel(); + structure.update(); + + require(["dijit/Tree"], function(Tree) { + tree = new Tree({ model: structure }, "structure"); + tree.on("dblclick", + function(object) + { + if(!object._dummyChild) + { + structure.relocate(object); + } + + }, true); + tree.startup(); + }); + + updateList.push(structure); + }); \ No newline at end of file Modified: qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/vhost.js URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/vhost.js?rev=1331987&r1=1331986&r2=1331987&view=diff ============================================================================== --- qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/vhost.js (original) +++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/js/vhost.js Sun Apr 29 20:20:06 2012 @@ -1,4 +1,23 @@ -var updateList = new Array(); +/* + * + * 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. + * + */ var bindingsTuple; @@ -40,7 +59,7 @@ require(["dojo/store/JsonRest", thisObj.vhostData.queues, "queues", [ { name: "Name", field: "name", width: "90px"}, { name: "Messages", field: "queueDepthMessages", width: "90px"}, - { name: "Arguments", field: "arguments", width: "200px"} + { name: "Arguments", field: "arguments", width: "100%"} ], function(obj) { @@ -63,7 +82,7 @@ require(["dojo/store/JsonRest", [ { name: "Name", field: "name", width: "120px"}, { name: "Type", field: "type", width: "120px"}, { name: "Binding Count", field: "bindingCount", - width: "90px"} + width: "100%"} ], function(obj) { @@ -94,7 +113,7 @@ require(["dojo/store/JsonRest", { name: "Msgs Out", field: "msgOutRate", width: "80px"}, { name: "Bytes Out", field: "bytesOutRate", - width: "80px"} + width: "100%"} ], function(obj) { @@ -258,11 +277,5 @@ require(["dojo/store/JsonRest", updater.update(); - setInterval(function(){ - for(var i = 0; i < updateList.length; i++) - { - var obj = updateList[i]; - obj.update(); - }}, 5000); }); Modified: qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/queue.html URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/queue.html?rev=1331987&r1=1331986&r2=1331987&view=diff ============================================================================== --- qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/queue.html (original) +++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/queue.html Sun Apr 29 20:20:06 2012 @@ -1,4 +1,24 @@ <!DOCTYPE HTML> +<!-- + - + - 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. + - + --> <html lang="en"> <head> <meta charset="utf-8"> @@ -26,6 +46,8 @@ <script> require(["dijit/layout/BorderContainer", "dijit/layout/TabContainer", "dijit/layout/ContentPane", "dijit/TitlePane", "dojo/parser"]); + + </script> <script src="/js/common.js"> @@ -34,19 +56,33 @@ </script> <script src="/js/sasl.js"> </script> + <script src="/js/header.js"></script> + <script src="/js/footer.js"></script> + <script src="/js/structure.js"></script> + + <script> + + require(["dojo/io-query", "dojo/domReady!"], + function(ioQuery){ + var query = dojo.doc.location.search.substr((dojo.doc.location.search[0] === "?" ? 1 : 0)); + var urlQuery = ioQuery.queryToObject(query); + new Header("Virtual Host: "+urlQuery.vhost +"<br/>Queue: "+urlQuery.queue); + }); + </script> + </head> <body class="claro"> - <div id="pageLayout" data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design: 'headline'"> - <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'top'"><div class="header"> - <div class="logo"> - </div> - </div></div> + <div id="pageLayout" data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design: 'headline', gutters: false"> + <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'top'"><div id="header" class="header"></div> + </div> <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'top'"> <div id="login"></div> </div> - <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'leading'">Leading pane</div> + <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'leading', splitter: true"> + <div id="structure"></div> + </div> <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'center'"> <span style="">Queue:</span><span id="name" style="position:absolute; left:6em"></span> <span style="position:absolute; left:26em">Size:</span> @@ -116,7 +152,7 @@ </div> </div> <!--<div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'trailing'">Trailing pane</div>--> - <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'bottom'">Bottom pane</div> + <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'bottom'"><div id="footer"></div></div> </div> </body> Modified: qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/vhost.html URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/vhost.html?rev=1331987&r1=1331986&r2=1331987&view=diff ============================================================================== --- qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/vhost.html (original) +++ qpid/branches/java-config-and-management/qpid/java/broker-plugins/management/src/main/java/resources/vhost.html Sun Apr 29 20:20:06 2012 @@ -1,4 +1,24 @@ <!DOCTYPE HTML> +<!-- + - + - 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. + - + --> <html lang="en"> <head> <meta charset="utf-8"> @@ -28,12 +48,13 @@ "dijit/TitlePane", "dojo/parser"]); </script> - <script src="/js/common.js"> - </script> - <script src="/js/vhost.js"> - </script> - <script src="/js/sasl.js"> - </script> + <script src="/js/common.js"></script> + <script src="/js/vhost.js"></script> + <script src="/js/sasl.js"></script> + <script src="/js/header.js"></script> + <script src="/js/footer.js"></script> + <script src="/js/structure.js"></script> + <script> require(["dojo/parser", /* dojox/ validate resources */ @@ -53,21 +74,26 @@ hideAddExchange = function() { registry.byId("addExchange").hide(); } + + + var urlQuery = dojo.queryToObject(dojo.doc.location.search.substr((dojo.doc.location.search[0] === "?" ? 1 : 0))); + + new Header("Virtual Host: "+urlQuery.vhost); }); </script> </head> <body class="claro"> - <div id="pageLayout" data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design: 'headline'"> - <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'top'"><div class="header"> - <div class="logo"> - </div> - </div> </div> + <div id="pageLayout" data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design: 'headline', gutters: false"> + <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'top'"><div id="header" class="header"></div> + </div> <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'top'"> <div id="login"></div> </div> - <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'leading'">Leading pane</div> + <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'leading', splitter: true"> + <div id="structure"></div> + </div> <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'center'"> <span style="">Name:</span><span id="name" style="position:absolute; left:6em"></span> <br/> @@ -215,7 +241,7 @@ </div> </div> <!--<div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'trailing'">Trailing pane</div>--> - <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'bottom'">Bottom pane</div> + <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'bottom'"><div id="footer"></div></div> </div> </body> Modified: qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/Attribute.java URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/Attribute.java?rev=1331987&r1=1331986&r2=1331987&view=diff ============================================================================== --- qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/Attribute.java (original) +++ qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/Attribute.java Sun Apr 29 20:20:06 2012 @@ -21,15 +21,12 @@ package org.apache.qpid.server.model; -public class Attribute<C extends ConfiguredObject, T> +public abstract class Attribute<C extends ConfiguredObject, T> { private final String _name; - private final Class<T> _type; - - public Attribute(String name, Class<T> type) + public Attribute(String name) { _name = name; - _type = type; } public String getName() @@ -37,15 +34,12 @@ public class Attribute<C extends Configu return _name; } - public Class<T> getType() - { - return _type; - } + abstract public Class<T> getType(); public T getValue(C configuredObject) { Object o = configuredObject.getAttribute(_name); - if(_type.isInstance(o)) + if(getType().isInstance(o)) { return (T) o; } @@ -57,4 +51,149 @@ public class Attribute<C extends Configu return (T) configuredObject.setAttribute(_name, expected, desired); } + abstract public T setValue(String stringValue, C configuredObject); + + static class StringAttribute<C extends ConfiguredObject> extends Attribute<C, String> + { + + public StringAttribute(String name) + { + super(name); + } + + @Override + public Class<String> getType() + { + return String.class; + } + + @Override + public String setValue(String stringValue, C configuredObject) + { + return setValue(getValue(configuredObject), stringValue, configuredObject); + } + + } + + static class IntegerAttribute<C extends ConfiguredObject> extends Attribute<C, Integer> + { + + public IntegerAttribute(String name) + { + super(name); + } + + @Override + public Class<Integer> getType() + { + return Integer.class; + } + + @Override + public Integer setValue(String stringValue, C configuredObject) + { + try + { + Integer val = Integer.valueOf(stringValue); + return setValue(getValue(configuredObject), val, configuredObject); + } + catch (NumberFormatException e) + { + throw new IllegalArgumentException(e); + } + } + } + + + static class LongAttribute<C extends ConfiguredObject> extends Attribute<C, Long> + { + + public LongAttribute(String name) + { + super(name); + } + + @Override + public Class<Long> getType() + { + return Long.class; + } + + @Override + public Long setValue(String stringValue, C configuredObject) + { + try + { + Long val = Long.valueOf(stringValue); + return setValue(getValue(configuredObject), val, configuredObject); + } + catch (NumberFormatException e) + { + throw new IllegalArgumentException(e); + } + } + } + + + static class DoubleAttribute<C extends ConfiguredObject> extends Attribute<C, Double> + { + + public DoubleAttribute(String name) + { + super(name); + } + + @Override + public Class<Double> getType() + { + return Double.class; + } + + @Override + public Double setValue(String stringValue, C configuredObject) + { + try + { + Double val = Double.valueOf(stringValue); + return setValue(getValue(configuredObject), val, configuredObject); + } + catch (NumberFormatException e) + { + throw new IllegalArgumentException(e); + } + } + } + + + static class FloatAttribute<C extends ConfiguredObject> extends Attribute<C, Float> + { + + public FloatAttribute(String name) + { + super(name); + } + + @Override + public Class<Float> getType() + { + return Float.class; + } + + @Override + public Float setValue(String stringValue, C configuredObject) + { + try + { + Float val = Float.valueOf(stringValue); + return setValue(getValue(configuredObject), val, configuredObject); + } + catch (NumberFormatException e) + { + throw new IllegalArgumentException(e); + } + } + } + + + } Modified: qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java?rev=1331987&r1=1331986&r2=1331987&view=diff ============================================================================== --- qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java (original) +++ qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java Sun Apr 29 20:20:06 2012 @@ -97,7 +97,8 @@ final class ConnectionAdapter extends Ab public String getName() { - return _connection.getRemoteAddressString(); + final String remoteAddressString = _connection.getRemoteAddressString(); + return remoteAddressString.replaceAll("/",""); } public String setName(final String currentName, final String desiredName) Modified: qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ConfigurationFileApplicationRegistry.java URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ConfigurationFileApplicationRegistry.java?rev=1331987&r1=1331986&r2=1331987&view=diff ============================================================================== --- qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ConfigurationFileApplicationRegistry.java (original) +++ qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ConfigurationFileApplicationRegistry.java Sun Apr 29 20:20:06 2012 @@ -21,6 +21,7 @@ package org.apache.qpid.server.registry; import org.apache.commons.configuration.ConfigurationException; +import org.apache.qpid.server.model.Broker; import org.osgi.framework.BundleContext; import org.apache.qpid.AMQException; --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
| Powered by Nabble | Edit this page |
