Commit 9d981975 authored by Bill Lynch's avatar Bill Lynch Committed by bill

Removed "xmlTest"


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@291 b35dd754-fafc-0310-a699-88a17e54d16e
parent 0109c2b7
<?xml version="1.0" encoding="UTF-8"?> <?xmlTest version="1.0" encoding="UTF-8"?>
<!-- <!--
This file stores bootstrap properties needed by Jive Messenger. This file stores bootstrap properties needed by Jive Messenger.
Property names must be in the format: "prop.name.is.blah=value" Property names must be in the format: "prop.name.is.blah=value"
......
...@@ -50,6 +50,16 @@ public class AdminConsole { ...@@ -50,6 +50,16 @@ public class AdminConsole {
private AdminConsole() { private AdminConsole() {
} }
/**
* Adds XML stream to the tabs/sidebar model.
*
* @param in the XML input stream.
* @throws Exception if an error occurs when parsing the XML or adding it to the model.
*/
public static void addXMLSource(InputStream in) throws Exception {
addToModel(in);
}
/** /**
* Returns all items starting from the root. Getting the iterator from this collection returns * Returns all items starting from the root. Getting the iterator from this collection returns
* all root items (should be used as tabs in the admin tool). * all root items (should be used as tabs in the admin tool).
...@@ -298,7 +308,7 @@ public class AdminConsole { ...@@ -298,7 +308,7 @@ public class AdminConsole {
URL url = null; URL url = null;
try { try {
if (classLoaders[i] != null) { if (classLoaders[i] != null) {
Enumeration e = classLoaders[i].getResources("META-INF/admin-sidebar.xml"); Enumeration e = classLoaders[i].getResources("/META-INF/admin-sidebar.xml");
while (e.hasMoreElements()) { while (e.hasMoreElements()) {
url = (URL)e.nextElement(); url = (URL)e.nextElement();
in = url.openStream(); in = url.openStream();
...@@ -322,41 +332,41 @@ public class AdminConsole { ...@@ -322,41 +332,41 @@ public class AdminConsole {
private static void addToModel(InputStream in) throws Exception { private static void addToModel(InputStream in) throws Exception {
// Build an XMLPropertiesTest object from the input stream: // Build an XMLPropertiesTest object from the input stream:
XMLProperties xmlTest = new XMLProperties(in); XMLProperties xml = new XMLProperties(in);
// Get all children of the 'tabs' element - should be 'tab' items: // Get all children of the 'tabs' element - should be 'tab' items:
String[] tabs = xmlTest.getChildrenProperties("tabs"); String[] tabs = xml.getChildrenProperties("tabs");
for (int i=0; i<tabs.length; i++) { for (int i=0; i<tabs.length; i++) {
String propName = "tabs." + tabs[i]; String propName = "tabs." + tabs[i];
// Create a new top level item with data from the xmlTest file: // Create a new top level item with data from the xml file:
String id = xmlTest.getProperty(propName + ".id"); String id = xml.getProperty(propName + ".id");
String name = xmlTest.getProperty(propName + ".name"); String name = xml.getProperty(propName + ".name");
String description = xmlTest.getProperty(propName + ".description"); String description = xml.getProperty(propName + ".description");
Item item = new Item(id, name, description, null); Item item = new Item(id, name, description, null);
// Add that item to the item collection // Add that item to the item collection
getItems().add(item); getItems().add(item);
// Delve down into this item's sidebars - build up a model of these then add into // Delve down into this item's sidebars - build up a model of these then add into
// the item above. // the item above.
String[] sidebars = xmlTest.getChildrenProperties(propName + ".sidebars"); String[] sidebars = xml.getChildrenProperties(propName + ".sidebars");
for (int j=0; j<sidebars.length; j++) { for (int j=0; j<sidebars.length; j++) {
String sidebarName = propName + ".sidebars." + sidebars[j]; String sidebarName = propName + ".sidebars." + sidebars[j];
name = xmlTest.getProperty(sidebarName + ".name"); name = xml.getProperty(sidebarName + ".name");
// Create a new item, set its name // Create a new item, set its name
Item subItem = new Item(null, name, null, null); Item subItem = new Item(null, name, null, null);
// Now iterate down another level, get the items for this item - this will be the // Now iterate down another level, get the items for this item - this will be the
// specific links on the sidebar // specific links on the sidebar
String[] subitems = xmlTest.getChildrenProperties(sidebarName + ".items"); String[] subitems = xml.getChildrenProperties(sidebarName + ".items");
for (int k=0; k<subitems.length; k++) { for (int k=0; k<subitems.length; k++) {
String subitemName = sidebarName + ".items." + subitems[k]; String subitemName = sidebarName + ".items." + subitems[k];
// Get the id, name, descr and url attributes: // Get the id, name, descr and url attributes:
String subID = xmlTest.getProperty(subitemName + ".id"); String subID = xml.getProperty(subitemName + ".id");
String subName = xmlTest.getProperty(subitemName + ".name"); String subName = xml.getProperty(subitemName + ".name");
String subDescr = xmlTest.getProperty(subitemName + ".description"); String subDescr = xml.getProperty(subitemName + ".description");
String subURL = xmlTest.getProperty(subitemName + ".url"); String subURL = xml.getProperty(subitemName + ".url");
// Build an item with this, add it to the subItem we made above // Build an item with this, add it to the subItem we made above
Item kItem = new Item(subID, subName, subDescr, subURL, subItem); Item kItem = new Item(subID, subName, subDescr, subURL, subItem);
subItem.getItems().add(kItem); subItem.getItems().add(kItem);
// Build any sub-sub menus: // Build any sub-sub menus:
subAddtoModel(subitemName, xmlTest, kItem); subAddtoModel(subitemName, xml, kItem);
// If this is the first item, set the root menu item's URL as this URL: // If this is the first item, set the root menu item's URL as this URL:
if (j==0 && k == 0) { if (j==0 && k == 0) {
item.setUrl(subURL); item.setUrl(subURL);
......
<?xmlTest version="1.0"?> <?xml version="1.0"?>
<jivesidebar> <jivesidebar>
<tabs> <tabs>
......
<?xmlTest version="1.0" encoding="ISO-8859-1"?> <?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
It appears setup has already been run. To administer your community, please use the It appears setup has already been run. To administer your community, please use the
<a href="index.jsp"><fmt:message key="short.title" bundle="${lang}" /> Admin Tool</a>. To re-run <a href="index.jsp"><fmt:message key="short.title" bundle="${lang}" /> Admin Tool</a>. To re-run
setup, you need to stop your appserver, delete the "setup" property from the setup, you need to stop your appserver, delete the "setup" property from the
jive-messenger.xmlTest file, restart Messenger then reload the setup tool. jive-messenger.xml file, restart Messenger then reload the setup tool.
</p> </p>
<form action="index.jsp"> <form action="index.jsp">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment