[esb-java-dev] svn commit r683 - in esb/java/trunk/modules/distribution/src/main: conf www/extensions/core www/extensions/core/css www/extensions/core/images www/extensions/core/js www/extensions/core/xslt

svn at wso2.com svn at wso2.com
Fri Feb 2 05:06:59 PST 2007


Author: chathura
Date: Fri Feb  2 05:06:27 2007
New Revision: 683

Added:
   esb/java/trunk/modules/distribution/src/main/conf/reg-meta-data.hbm.xml
   esb/java/trunk/modules/distribution/src/main/www/extensions/core/images/file.gif   (contents, props changed)
   esb/java/trunk/modules/distribution/src/main/www/extensions/core/images/folder_close.gif   (contents, props changed)
   esb/java/trunk/modules/distribution/src/main/www/extensions/core/images/folder_open.gif   (contents, props changed)
   esb/java/trunk/modules/distribution/src/main/www/extensions/core/js/esbregistry.js
   esb/java/trunk/modules/distribution/src/main/www/extensions/core/js/folder.js
   esb/java/trunk/modules/distribution/src/main/www/extensions/core/js/regfile.js
   esb/java/trunk/modules/distribution/src/main/www/extensions/core/js/root.js
Modified:
   esb/java/trunk/modules/distribution/src/main/conf/synapse.xml
   esb/java/trunk/modules/distribution/src/main/conf/wso2esb.hibernate.cfg.xml
   esb/java/trunk/modules/distribution/src/main/www/extensions/core/css/wso2-esb.css
   esb/java/trunk/modules/distribution/src/main/www/extensions/core/js.html
   esb/java/trunk/modules/distribution/src/main/www/extensions/core/js/properties.js
   esb/java/trunk/modules/distribution/src/main/www/extensions/core/js/registry.js
   esb/java/trunk/modules/distribution/src/main/www/extensions/core/menu.html
   esb/java/trunk/modules/distribution/src/main/www/extensions/core/xslt/edit_property.xsl
Log:
Implemented the UI for accessing registry using tree view and displaying and updating registry metadata.

Added: esb/java/trunk/modules/distribution/src/main/conf/reg-meta-data.hbm.xml
==============================================================================
--- (empty file)
+++ esb/java/trunk/modules/distribution/src/main/conf/reg-meta-data.hbm.xml	Fri Feb  2 05:06:27 2007
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping>    
+
+    <class name="org.wso2.esb.persistence.dataobject.RegistryEntryDO"
+           table="registry_entry_t">
+        <id name="id" column="c_id">
+            <generator class="native"/>
+        </id>
+        <property name="lastUpdatedTime" type="timestamp" column="c_last_updated" not-null="true"/>
+
+        <property name="registryKey" column="c_registry_key" not-null="true" unique="true"/>
+        <property name="expiryTime" column="c_expiry_time" />
+    </class>
+
+</hibernate-mapping>
\ No newline at end of file

Modified: esb/java/trunk/modules/distribution/src/main/conf/synapse.xml
==============================================================================
--- esb/java/trunk/modules/distribution/src/main/conf/synapse.xml	(original)
+++ esb/java/trunk/modules/distribution/src/main/conf/synapse.xml	Fri Feb  2 05:06:27 2007
@@ -16,7 +16,7 @@
 
 <esb_synapse xmlns="http://ws.apache.org/ns/synapse">
 
-    <registry provider="org.apache.synapse.registry.url.SimpleURLRegistry">
+    <registry provider="org.wso2.esb.registry.ESBRegistry">
         <property name="root" value="file:registry"/>
         <property name="cachableDuration" value="15000"/>
     </registry>

Modified: esb/java/trunk/modules/distribution/src/main/conf/wso2esb.hibernate.cfg.xml
==============================================================================
--- esb/java/trunk/modules/distribution/src/main/conf/wso2esb.hibernate.cfg.xml	(original)
+++ esb/java/trunk/modules/distribution/src/main/conf/wso2esb.hibernate.cfg.xml	Fri Feb  2 05:06:27 2007
@@ -29,6 +29,7 @@
 
         <!-- mapping files -->
         <mapping resource="statistics.hbm.xml"/>
+        <mapping resource="reg-meta-data.hbm.xml"/>
         <!--<mapping name="org.wso2.esb.statistics.persistence.hibernate.bean.StatisticsDO" />-->
 
     </session-factory>

Modified: esb/java/trunk/modules/distribution/src/main/www/extensions/core/css/wso2-esb.css
==============================================================================
--- esb/java/trunk/modules/distribution/src/main/www/extensions/core/css/wso2-esb.css	(original)
+++ esb/java/trunk/modules/distribution/src/main/www/extensions/core/css/wso2-esb.css	Fri Feb  2 05:06:27 2007
@@ -172,6 +172,134 @@
     _margin-top: 0;
 }
 
+div#propEditRegistryKeyListDiv {
+    position:relative;
+    width:600px;
+    _width:100%;
+    _position:absolute;
+}
+
+div#propEditRegistryKeySelectBox {
+    float:left;
+    margin-left: 0px;
+    margin-top:0;
+    border: 1px solid gray;
+    padding: 5px;
+    width: 200px;
+    height:200px;
+    position:relative;
+
+    _margin-top:40;
+    _height:190px;
+}
+
+div#propEditRegistryKeyData {
+    float:left;
+    margin-top: 0;
+    margin-left: 230px;
+    border: 1px solid gray;
+    padding: 5px;
+    width: 300px;
+    height:200px;
+    position:relative;
+
+    _margin-top: 40;
+    _margin-left: 470px;
+    _height: 190px;
+    _position: absolute;
+}
+
+div#registryKeyListDiv {
+    position:relative;
+    _width:100%;
+    _position:absolute;
+}
+
+div#registryKeySelectBox {
+    float:left;
+    margin-left: 210px;
+    margin-top:0;
+    border: 1px solid gray;
+    padding: 5px;
+    width: 200px;
+    height:200px;
+    position:absolute;
+
+    _margin-top:40;
+    _height:190px;
+}
+
+div#registryKeyData {
+    float:left;
+    margin-top: 0;
+    margin-left: 430px;
+    border: 1px solid gray;
+    padding: 5px;
+    width: 300px;
+    height:200px;
+    position:absolute;
+
+    _margin-top: 40;
+    _margin-left: 470px;
+    _height: 190px;
+    _position: absolute;
+}
+
+div#regBrowser {
+    position:relative;
+    _width:100%;
+    _position:absolute;
+}
+
+div#regKeys {
+    float:left;
+    margin-left: 220px;
+    margin-top:0;
+    border: 1px solid gray;
+    padding: 5px;
+    width: 250px;
+    height:300px;
+    position:absolute;
+    overflow:auto;
+
+    _position: absolute;
+    _margin-top:40;
+    _height:190px;
+}
+
+div#regKeyData {
+    float:left;
+    margin-top: 0;
+    margin-left: 490px;
+    border: 1px solid gray;
+    padding: 5px;
+    width: 300px;
+    height:300px;
+    position:absolute;
+    overflow:auto;
+
+    _margin-top: 40;
+    _margin-left: 470px;
+    _height: 190px;
+    _position: absolute;
+}
+
+div#regUtils {
+    float:left;
+    margin-left: 210px;
+    margin-top:320px;
+    border: 1px solid gray;
+    padding: 5px;
+    margin-left:0;
+    width: 600px;
+    height:500px;
+    position:relative;
+
+    _position: absolute;
+    _margin-top:250px;
+    _height:190px;
+}
+
 div#top1 {
     padding: 5px;
     background-color: #9FAAB5;

Added: esb/java/trunk/modules/distribution/src/main/www/extensions/core/images/file.gif
==============================================================================
Binary file. No diff available.

Added: esb/java/trunk/modules/distribution/src/main/www/extensions/core/images/folder_close.gif
==============================================================================
Binary file. No diff available.

Added: esb/java/trunk/modules/distribution/src/main/www/extensions/core/images/folder_open.gif
==============================================================================
Binary file. No diff available.

Modified: esb/java/trunk/modules/distribution/src/main/www/extensions/core/js.html
==============================================================================
--- esb/java/trunk/modules/distribution/src/main/www/extensions/core/js.html	(original)
+++ esb/java/trunk/modules/distribution/src/main/www/extensions/core/js.html	Fri Feb  2 05:06:27 2007
@@ -1,3 +1,19 @@
+<!--
+  ~ Copyright (c) 2006, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+  ~
+  ~ Licensed 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.
+  -->
+
 <script language="javascript" src="extensions/core/js/system.js"></script>
 <script language="javascript" src="extensions/core/js/logs.js"></script>
 <script language="javascript" src="extensions/core/js/trace.js"></script>
@@ -8,6 +24,10 @@
 <script language="javascript" src="extensions/core/js/esb.js"></script>
 <script language="javascript" src="extensions/core/js/mediators.js"></script>
 <script language="javascript" src="extensions/core/js/registry.js"></script>
+<script language="javascript" src="extensions/core/js/esbregistry.js"></script>
+<script language="javascript" src="extensions/core/js/root.js"></script>
+<script language="javascript" src="extensions/core/js/folder.js"></script>
+<script language="javascript" src="extensions/core/js/regfile.js"></script>        
 <script language="javascript" src="extensions/core/js/commons.js"></script>
 <script language="javascript" src="extensions/core/js/config.js"></script>
 <script language="javascript" src="extensions/core/js/_proxyservices.js"></script>
@@ -22,22 +42,6 @@
 <script language="javascript" src="extensions/core/js/plotkit/Canvas.js"></script>
 <script language="javascript" src="extensions/core/js/plotkit/SweetCanvas.js"></script>
 <script language="javascript" src="extensions/core/js/plotkit/excanvas.js"></script>
-<!--
-  ~ Copyright (c) 2006, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-  ~
-  ~ Licensed 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.
-  -->
-
 <script language="javascript" src="extensions/core/js/xmlTree.js"></script>
 <script language="javascript" src="extensions/core/js/help.js"></script>
 

Added: esb/java/trunk/modules/distribution/src/main/www/extensions/core/js/esbregistry.js
==============================================================================
--- (empty file)
+++ esb/java/trunk/modules/distribution/src/main/www/extensions/core/js/esbregistry.js	Fri Feb  2 05:06:27 2007
@@ -0,0 +1,344 @@
+/*
+ * Copyright (c) 2006, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed 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 REGISTRY_MANAGEMENT = "RegistryAdmin";
+var REGISTRY_DIV = "divRegistry";
+
+var REGISTRY_BROWSER_DIV = "regBrowser";
+var REGISTRY_TREE_DIV = "regKeys";
+var REGISTRY_DATA_DIV = "regKeyData";
+
+var NEW_FOLDER_UTIL = "1";
+var NEW_FILE_UTIL = "2";
+var EDIT_FILE_UTIL = "3";
+var utilPanel = "1";
+
+var tempEntry;
+
+var regTree = null;
+
+function showESBRegistry() {
+    var body_xml = '<ns1:getDefaultRegistryName xmlns:ns1="http://org.apache.synapse/xsd">' +
+                   '</ns1:getDefaultRegistryName>';
+
+    var callURL = serverURL + "/" + "RegistryAdmin" + "/" + "getDefaultRegistryName";
+
+    send("getDefaultRegistryName", body_xml, "", callURL, "", false, showESBRegistryCallback);
+
+}
+
+function showESBRegistryCallback() {
+
+    var body = xhReq.responseXML.getElementsByTagName("Body")[0];
+
+    var registryNameTag = body.getElementsByTagName("return")[0];
+    var registryName = registryNameTag.textContent;
+
+    if (registryName == "ESB Registry") {
+        showESBRegistryWindow();
+    } else {
+        var regDiv = document.getElementById(REGISTRY_DIV);
+        regDiv.innerHTML = "<p>Management console does not support the specified registry.</p>";
+        showOnlyOneMain(regDiv);
+    }
+}
+
+function showESBRegistryWindow() {
+
+    var regDiv = document.getElementById(REGISTRY_DIV);
+
+    var regUtilPanelContent = "<input type='button' value='New folder' onClick='javascript:newFolderPanel();return false;' />" +
+                              "<input type='button' value='New file' onClick='javascript:newFilePanel();return false;' />" +
+                              "<input type='button' value='Edit file' onClick='javascript:editFilePanel();return false;' />";
+
+    var newFolderDivContent =  "<br /><lable>Folder name: </label><input type='text' id='regNewFolderName' size='30' /><br /><br />" +
+                               "<input type='button' value='Create folder' onClick='javascript:addRegistryFolder();return false;' /> ";
+
+    var editFileDivContent = "<textarea cols='80' rows='20' id='regEditFileContents'></textarea><br /><br />" +
+                             "<input type='button' value='Save' onClick='javascript:editRegistryFile();return false;' />";
+
+    var newFileDivContent = "<div id='newEditFileDiv' style='display:block'>" +
+                            "<label>File name: </label><input id='regNewFileName' type='text' size='30' /><br /><br />" +
+                            "<textarea id='regFileContent' cols='80' rows='20'></textarea><br />" +
+                            "<input type='button' value='Create file' onClick='javascript:addRegistryFile();return false;' /></div>";
+
+            //"<label>Upload file: </label><input type='file' value='Upload file' onClick='javascript:uploadRegistryFile();return false;' /> ";
+
+    var structure = "<div id='regBrowser'>"
+    structure += "<div id='regKeys'></div><div id='regKeyData'>Select a registry entry to view details.</div>";
+    structure += "<div id='regUtils'>" +
+                 "<div id='regUtilPanel'>" + regUtilPanelContent + "</div><br />" +
+                 "<div id='newFolderDiv' style='display:block'>" + newFolderDivContent + "</div>" +
+                 "<div id='editFileDiv' style='display:none'>" + editFileDivContent + "</div>" +
+                 "<div id='newFileDiv' style='display:none'>" + newFileDivContent + "</div>" +
+                 "</div></div>";
+
+    regDiv.innerHTML = structure;
+    showOnlyOneMain(regDiv);
+
+    showMainRegistryPanel('regKeys', regFolderSelectCallback, "");
+}
+
+function resetRegistryPanel() {
+    regTree.reset();
+    newFolderPanel();
+    var dataPanel = document.getElementById("regKeyData");
+    dataPanel.innerHTML = "Select a registry entry to view details.";
+}
+
+function newFolderPanel() {
+    var folderEditor = document.getElementById("regNewFolderName");
+    folderEditor.value = "";
+
+    var div1 = document.getElementById('newFolderDiv');
+    div1.style.display = "block";
+
+    var div2 = document.getElementById('editFileDiv');
+    div2.style.display = "none";
+
+    var div3 = document.getElementById('newFileDiv');
+    div3.style.display = "none";
+
+    utilPanel = NEW_FOLDER_UTIL;
+}
+
+function editFilePanel() {
+    var div1 = document.getElementById('newFolderDiv');
+    div1.style.display = "none";
+
+    var div2 = document.getElementById('editFileDiv');
+    div2.style.display = "block";
+
+    var div3 = document.getElementById('newFileDiv');
+    div3.style.display = "none";
+
+    var selectedFile = regTree.getSelected();
+    loadRegistryFile(selectedFile);
+
+    utilPanel = EDIT_FILE_UTIL;
+}
+
+function newFilePanel() {
+
+    var newFileName = document.getElementById('regNewFileName');
+    newFileName.value = "";
+
+    var fileEditor = document.getElementById('regFileContent');
+    fileEditor.value = "";
+
+    var div1 = document.getElementById('newFolderDiv');
+    div1.style.display = "none";
+
+    var div2 = document.getElementById('editFileDiv');
+    div2.style.display = "none";
+
+    var div3 = document.getElementById('newFileDiv');
+    div3.style.display = "block";
+
+    utilPanel = NEW_FILE_UTIL;
+}
+
+function addRegistryFolder() {
+
+    var newFolderName = document.getElementById("regNewFolderName").value;
+
+    var parentFolder = "";
+    if (regTree.getSelected() != null)
+        parentFolder = regTree.getSelected();
+
+    var body_xml = '<ns1:createFolder xmlns:ns1="http://org.apache.synapse/xsd">' +
+                   '<folder>' +
+                   '<parent>' + parentFolder + '</parent>' +
+                   '<folderName>' + newFolderName + '</folderName>' +
+                   '</folder>' +
+                   '</ns1:createFolder>';
+
+    var callURL = serverURL + "/" + "RegistryAdmin" + "/" + "createFolder";
+
+    send("createFolder", body_xml, "", callURL, "", false, regCreateFolderCallback);
+}
+
+function regCreateFolderCallback() {
+    var body = xhReq.responseXML.getElementsByTagName("Body")[0];
+    if (body != null) {
+        resetRegistryPanel();
+    }
+}
+
+function addRegistryFile() {
+
+    var newFileName = document.getElementById("regNewFileName").value;
+    var fileContent = document.getElementById("regFileContent").value;
+    var contentPart = "";
+    if (fileContent != null & fileContent != "") {
+        contentPart = "<content>" + fileContent + "</content>";
+    }
+
+    var parentFolder = "";
+    if (regTree.getSelected() != null)
+        parentFolder = regTree.getSelected();
+
+    var body_xml = '<ns1:createFile xmlns:ns1="http://org.apache.synapse/xsd">' +
+                   '<file>' +
+                   '<parent>' + parentFolder + '</parent>' +
+                   '<fileName>' + newFileName + '</fileName>' +
+                   contentPart +
+                   '</file>' +
+                   '</ns1:createFile>';
+
+    var callURL = serverURL + "/" + "RegistryAdmin" + "/" + "createFile";
+
+    send("createFile", body_xml, "", callURL, "", false, regCreateFileCallback);
+}
+
+function regCreateFileCallback() {
+    var body = xhReq.responseXML.getElementsByTagName("Body")[0];
+    if (body != null) {
+        resetRegistryPanel();
+    }
+}
+
+function loadRegistryFile(key) {
+
+    var body_xml = '<ns1:getRegistryEntryValue xmlns:ns1="http://org.apache.synapse/xsd">' +
+                   '<regKey>' + key + '</regKey>' +
+                   '</ns1:getRegistryEntryValue>';
+
+    var callURL = serverURL + "/" + "RegistryAdmin" + "/" + "getRegistryEntryValue";
+
+    send("getRegistryEntryValue", body_xml, "", callURL, "", false, regLoadRegistryFileCallback);
+}
+
+function regLoadRegistryFileCallback() {
+
+    var body = xhReq.responseXML.getElementsByTagName("Body")[0];
+
+    var fileContents;
+
+    var errMsg = getNodeFromPath("error", body);
+    if (errMsg != null) {
+        fileContents = errMsg.textContent;
+    } else {
+        var valueContent = body.getElementsByTagName("value")[0];
+        if (valueContent != null) {
+            var a  = new XMLSerializer().serializeToString(valueContent);
+            fileContents = a.substring(7, a.length-8)
+        }
+    }
+
+    var editor = document.getElementById("regEditFileContents");
+    editor.value = fileContents;
+}
+
+function editRegistryFile() {
+
+    var fileContent = document.getElementById("regEditFileContents").value;
+
+    var body_xml = '<ns1:updateRegistryEntryValue xmlns:ns1="http://org.apache.synapse/xsd">' +
+                   '<regEntry>' +
+                   '<key>'+ regTree.getSelected() +'</key>' +
+                   '<value>' + fileContent + '</value>' +
+                   '</regEntry>' +
+                   '</ns1:updateRegistryEntryValue>';
+
+    var callURL = serverURL + "/" + "RegistryAdmin" + "/" + "updateRegistryEntryValue";
+
+    send("updateRegistryEntryValue", body_xml, "", callURL, "", false, regLoadRegistryFileCallback);
+
+}
+
+function showMainRegistryPanel(divName, selectHandlerParam, selectedValue) {
+
+    regTree = new root(divName, "reg root");
+    regTree.registerFolderSelectHandler(selectHandlerParam);
+
+    // show in the collapsed state
+    regTree.show(selectedValue);
+}
+
+function regFolderSelectCallback(entry) {
+
+    var body_xml = '<ns1:getRegistryEntry xmlns:ns1="http://org.apache.synapse/xsd">' +
+                   '<regKey>' + entry + '</regKey>' +
+                   '</ns1:getRegistryEntry>';
+
+    var callURL = serverURL + "/" + "RegistryAdmin" + "/" + "getRegistryEntry";
+
+    send("getRegistryEntry", body_xml, "", callURL, "", false, regGetRegistryEntryCallback);
+}
+
+function regGetRegistryEntryCallback() {
+
+    var body = xhReq.responseXML.getElementsByTagName("Body")[0];
+
+    var keyValue;
+
+    // contruct a text to show in data area
+    var data;
+
+    var fault = getNodeFromPath("Fault", body);
+    if (fault != null) {
+        data = "Error occured while accessing registry data.<br />" + fault.textContent;
+    } else {
+        var msg = getNodeFromPath("message", body);
+        if (msg != null) {
+            data = msg.textContent;
+        } else {
+            var regKey = getNodeFromPath("key", body);
+            if (regKey != null) {
+                data = "Key: ";
+                data += "<input type='text' readOnly='true' id='regKey' size='30' value='" + regKey.textContent + "' /><br /><br />";
+                keyValue = regKey.textContent;
+            }
+
+            var exTime = getNodeFromPath("expiryTime", body);
+            if (exTime != null) {
+                data += "Expiry time: ";
+                data += "<input type='text' id='regExTime' value='" + exTime.textContent + "' /><br /><br />";
+            }
+
+            data += "<input type='button' value='Update' onClick='javascript:updateRegistryData();return false;' />";
+        }
+    }
+
+    var regDataElement = document.getElementById(REGISTRY_DATA_DIV);
+    regDataElement.innerHTML = data;
+
+    if (utilPanel == EDIT_FILE_UTIL) {
+        loadRegistryFile(keyValue);
+    }
+}
+
+function updateRegistryData() {
+
+    var regKey = document.getElementById('regKey').value;
+    var regExTime = document.getElementById('regExTime').value;
+
+    var body_xml = '<ns1:updateRegistryEntry xmlns:ns1="http://org.apache.synapse/xsd">' +
+                   '<regEntry>' +
+                   '<key>' + regKey + '</key>' +
+                   '<expiryTime>' + regExTime + '</expiryTime>' +
+                   '</regEntry>' +
+                   '</ns1:updateRegistryEntry>';
+
+    var callURL = serverURL + "/" + "RegistryAdmin" + "/" + "updateRegistryEntry";
+
+    send("updateRegistryEntry", body_xml, "", callURL, "", false, regUpdateRegistryEntryCallback);
+}
+
+function regUpdateRegistryEntryCallback() {
+    alert("Update completed.");
+}

Added: esb/java/trunk/modules/distribution/src/main/www/extensions/core/js/folder.js
==============================================================================
--- (empty file)
+++ esb/java/trunk/modules/distribution/src/main/www/extensions/core/js/folder.js	Fri Feb  2 05:06:27 2007
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2006, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed 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.
+ */
+
+
+/* folder class */
+
+function folder(path, name){
+    this.state = COLLAPSED;
+    this.path = path; // path is used as an unique id
+    this.name = name;
+    this.write = writeFolder;
+    this.add = addFolderChild;
+    this.getMatchingChild = getMatchingFolderChild;
+    this.folderChildren = new Array();
+    this.expand = expandFolder;
+    this.collapse = collapseSubFolder;
+    this.getState = getSubFolderState;
+}
+
+function getSubFolderState() {
+    return this.state;
+}
+
+/**
+ Collapse the folder and all its descendants.
+ */
+function collapseSubFolder() {
+
+    hideFolder(this.path);
+    this.state = COLLAPSED;
+    var numFolders = this.folderChildren.length;
+    for (var i=0;i <numFolders;i++) {
+        this.folderChildren[i].collapse();
+    }
+}
+
+function expandFolder(folder) {
+
+    this.state = EXPANDED;
+    var subFolder = this.getMatchingChild(folder);
+
+    if(subFolder != null) {
+        showFolder(subFolder.path);
+        subFolder.expand(folder);
+    }
+}
+
+function addFolderChild(child){
+    this.folderChildren[this.folderChildren.length] = child;
+}
+
+function getMatchingFolderChild(path) {
+
+    var currentMatch = null;
+
+    var numLeaves = this.folderChildren.length;
+    for (var j = 0; j < numLeaves; j++) {
+        if(path.indexOf(this.folderChildren[j].path) == 0) {
+            if(currentMatch == null) {
+                currentMatch = this.folderChildren[j];
+            } else {
+                if(currentMatch.path.length < this.folderChildren[j].path.length) {
+                    currentMatch = this.folderChildren[j];
+                }
+            }
+        }
+    }
+
+    return currentMatch;
+}
+
+
+function writeFolder(){
+
+    var folderName;
+    var fNames = this.path.split("/");
+    if(fNames.length == 0) {
+        folderName = this.path;
+    } else {
+        folderName = fNames[fNames.length - 1];
+    }
+
+    var expanderImg;
+    var folderImg;
+    if(this.getState() == EXPANDED) {
+        expanderImg = expandedImg.src;
+        folderImg = folderopenImg.src;
+    } else {
+        expanderImg = collapsedImg.src;
+        folderImg = foldercloseImg.src;
+    }
+
+    var folderString = '<span style="cursor:pointer; cursor:hand; display:normal" ';
+    folderString += '><img src=' + expanderImg + ' id="E' + this.path + '" style="cursor:pointer; cursor:hand; display:normal" ' +
+                    'onClick="thisObject.expanderClick(\'' + this.path + '\')"/></span>';
+
+    folderString += '<span id="F' + this.path + '" style="cursor:pointer; cursor:hand; display:normal" ' +
+                    'onClick="thisObject.onFolderClick(\'' + this.path + '\')"';
+    folderString += '><img src=' + folderImg + ' id="FI' + this.path + '"><label style="cursor:pointer; cursor:hand; display:normal" id="l' + this.path + '">' + folderName + '</label></span><br />';
+
+    folderString += '<span style="display:none; margin-left:16px" id="';
+    folderString += this.path + '">';
+    var numLeaves = this.folderChildren.length;
+    for (var j=0;j<numLeaves;j++)
+        folderString += this.folderChildren[j].write();
+    folderString += '</span>';
+
+    return folderString;
+}

Modified: esb/java/trunk/modules/distribution/src/main/www/extensions/core/js/properties.js
==============================================================================
--- esb/java/trunk/modules/distribution/src/main/www/extensions/core/js/properties.js	(original)
+++ esb/java/trunk/modules/distribution/src/main/www/extensions/core/js/properties.js	Fri Feb  2 05:06:27 2007
@@ -19,7 +19,11 @@
 */
 
 var PROPERTIES_MANAGEMENT = "PropertiesAdmin";
-var registryKeyDivName = "";
+var registryKeyDivName = "registryKeySelectBox";
+var registryKeyDataDivName = 'registryKeyData';
+
+/* instance of the root for properties page */
+var filetree = null;
 
 function showProperties() {
 
@@ -75,7 +79,9 @@
 
     var type = document.getElementById("property_type").value;
     if(type == "Registry Key") {
-        populateRegistryKeyList("registryKeySelectBox", currentValue);
+        registryKeyDivName = "propEditRegistryKeySelectBox";
+        registryKeyDataDivName = "propEditRegistryKeyData";
+        showRegistryPanel();
     }
 }
 
@@ -124,11 +130,6 @@
 
     objDiv.innerHTML = strHTML;
     showOnlyOneMain(objDiv);
-    testthis();
-}
-
-function testthis() {
-    alert("done");
 }
 
 function showChanges() {
@@ -176,7 +177,7 @@
                    "<option>Source URL</option>" +
                    "<option selected='true'>Registry Key</option>" +
                    "</select></div>"+
-                   "<br/><div id='registryKeyListDiv'><label style='width: 200px; text-align: left'><strong style='color: black'>Property Key<font color='red'>*</font></strong></label><div id='registryKeySelectBox' /></div>";
+                   "<br/><input type='hidden' id='propertyKey' /><div id='registryKeyListDiv'><label style='width: 200px; text-align: left'><strong style='color: black'>Property Key<font color='red'>*</font></strong></label><div id='registryKeySelectBox'></div><div id='registryKeyData'>Select a registry entry to view details.</div></div>";
     }
     if(propertyType == "Source URL") {
         selected = "<option>String Literal</option>" +
@@ -209,8 +210,102 @@
     showOnlyOneMain(objDiv);
 
     if(propertyType == "Registry Key") {
-        populateRegistryKeyList("registryKeySelectBox", "");
+        registryKeyDivName = "registryKeySelectBox";
+        registryKeyDataDivName = 'registryKeyData';
+        showRegistryPanel();
+    }
+}
+
+function showRegistryPanel() {
+    var body_xml = '<ns1:getDefaultRegistryName xmlns:ns1="http://org.apache.synapse/xsd">' +
+                   '</ns1:getDefaultRegistryName>';
+
+    var callURL = serverURL + "/" + "RegistryAdmin" + "/" + "getDefaultRegistryName";
+
+    send("getDefaultRegistryName", body_xml, "", callURL, "", false, showPropertyRegistryCallback);
+}
+
+function showPropertyRegistryCallback() {
+    var body = xhReq.responseXML.getElementsByTagName("Body")[0];
+
+    var registryNameTag = body.getElementsByTagName("return")[0];
+    var registryName = registryNameTag.textContent;
+
+    if (registryName == "ESB Registry") {
+        showESBRegistryPanel(registryKeyDivName, regPropertyFolderSelectHandler, "");
+    } else {
+        var normalRegDiv = document.getElementById('registryKeyListDiv');
+        normalRegDiv.innerHTML = "<label style='width: 200px; text-align: left'><strong style='color: black'>Property Key<font color='red'>*</font></strong></label><input id='properyKey' type='text' size='30' />";
+    }
+}
+
+/**
+    This is the only function exposed to the rest of the application. Whenever some part wants to
+    get a registry key input from the user it call this. This function will interact with the user
+    and assign the selected key to a element named propertyKey. So that the caller can get the value
+    using document.getElementById('propertyKey').value.
+
+    @param divName Name of the html div element to be used for displaying registry panel
+    @param selectedValue Currently selected registry key, if available. If no keys are selected
+            supply null.
+*/
+function showESBRegistryPanel(divName, selectHandlerParam, selectedValue) {
+
+    // there is only one filetree for the entire application. so we can avoid repeated population
+    // of folders
+    filetree = new root(divName, "property root");
+    filetree.registerFolderSelectHandler(selectHandlerParam);
+
+    // show in the collapsed state
+    filetree.show(selectedValue);
+}
+
+function regPropertyFolderSelectHandler(folder) {
+
+    var objProperyKey = document.getElementById("propertyKey");
+    objProperyKey.value = folder;
+
+    var body_xml = '<ns1:getRegistryEntry xmlns:ns1="http://org.apache.synapse/xsd">' +
+                   '<regKey>' + folder + '</regKey>' +
+                   '</ns1:getRegistryEntry>';
+
+    var callURL = serverURL + "/" + "RegistryAdmin" + "/" + "getRegistryEntry";
+
+    send("getRegistryEntry", body_xml, "", callURL, "", false, getRegistryEntryCallback);
+}
+
+function getRegistryEntryCallback() {
+
+    var body = xhReq.responseXML.getElementsByTagName("Body")[0];
+
+    // contruct a text to show in data area
+    var data;
+
+    var fault = getNodeFromPath("Fault", body);
+    if (fault != null) {
+        data = "Error occured while accessing registry data.<br />" + fault.textContent;
+    } else {
+        var msg = getNodeFromPath("message", body);
+        if (msg != null) {
+            data = msg.textContent;
+        } else {
+            var regKey = getNodeFromPath("key", body);
+            if (regKey != null) {
+                data = "Key: " + regKey.textContent;
+            }
+
+            var exTime = getNodeFromPath("expiryTime", body);
+            if (exTime != null) {
+                data += "<br />Expiry time: " + exTime.textContent;
+            }
+        }
     }
+
+    //var objProperyKey = document.getElementById("propertyKey");
+    //objProperyKey.value = data;
+
+    var regDataElement = document.getElementById(registryKeyDataDivName);
+    regDataElement.innerHTML = data;
 }
 
 function addPropertySave() {
@@ -314,5 +409,4 @@
         return;
     }
     showProperties();
-}
-
+}
\ No newline at end of file

Added: esb/java/trunk/modules/distribution/src/main/www/extensions/core/js/regfile.js
==============================================================================
--- (empty file)
+++ esb/java/trunk/modules/distribution/src/main/www/extensions/core/js/regfile.js	Fri Feb  2 05:06:27 2007
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2006, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed 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.
+ */
+
+/* regfile class */
+
+function regfile(path, name){
+    this.state = EXPANDED;
+    this.path = path; // path is used as an unique id
+    this.name = name;
+    this.write = writeFile;
+    this.add = addFileChild;
+    this.getMatchingChild = getMatchingFileChild;
+    this.expand = expandFile;
+    this.collapse = collapseFile;
+    this.getState = getFileState;
+}
+
+function getFileState() {
+    return this.state;
+}
+
+/**
+ Collapse the folder and all its descendants.
+ */
+function collapseFile() {
+
+}
+
+function expandFile(folder) {
+
+}
+
+function addFileChild(child){
+
+}
+
+function getMatchingFileChild(path) {
+
+    if (path.indexOf(this.path) == 0) {
+        return this;
+    } else {
+        return null;
+    }
+}
+
+
+function writeFile(){
+
+    var folderName;
+    var fNames = this.path.split("/");
+    if(fNames.length == 0) {
+        folderName = this.path;
+    } else {
+        folderName = fNames[fNames.length - 1];
+    }
+
+    expanderImg = expandedImg.src;
+
+    var fileString = '<span style="cursor:pointer; cursor:hand; display:normal" ';
+    fileString += '><img src=' + expanderImg + ' id="E' + this.path + '" style="cursor:pointer; cursor:hand; display:normal"/></span>';
+
+    fileString += '<span id="F' + this.path + '" style="cursor:pointer; cursor:hand; display:normal" ' +
+                    'onClick="thisObject.onFolderClick(\'' + this.path + '\')"';
+    fileString += '><img src='+ fileImg.src + '><label style="cursor:pointer; cursor:hand; display:normal" id="l' + this.path + '">' + folderName + '</label></span><br />';
+
+    fileString += '<span style="display:none; margin-left:16px" id="';
+    fileString += this.path + '"></span>';
+
+    //showStuffInNewWindow(folderString);
+    return fileString;
+}

Modified: esb/java/trunk/modules/distribution/src/main/www/extensions/core/js/registry.js
==============================================================================
--- esb/java/trunk/modules/distribution/src/main/www/extensions/core/js/registry.js	(original)
+++ esb/java/trunk/modules/distribution/src/main/www/extensions/core/js/registry.js	Fri Feb  2 05:06:27 2007
@@ -19,8 +19,6 @@
 */
 
 var REGISTRY_MANAGEMENT = "RegistryAdmin";
-var registryKeyDivName = "";
-var selectedValue = "";
 
 function showRegistries() {
     var body_xml = '<ns1:registryDataRequest xmlns:ns1="http://org.apache.synapse/xsd">' +
@@ -41,53 +39,3 @@
     alert("Adding a registry through the admin UI is not yet supported");
     return;
 }
-
-function populateRegistryKeyList(divName, defaultValue) {
-
-    registryKeyDivName = divName;
-    selectedValue = defaultValue;
-
-    var body_xml = '<ns1:getDescendants xmlns:ns1="http://org.apache.synapse/xsd">' +
-                   '</ns1:getDescendants>';
-
-    var callURL = serverURL + "/" + "RegistryAdmin" + "/" + "getDescendants";
-
-    send("getDescendants", body_xml, "", callURL, "", false, populateRegistryKeyListCallback);
-}
-
-function populateRegistryKeyListCallback() {
-
-    var registryKeyDiv = document.getElementById(registryKeyDivName);
-
-    var body = xhReq.responseXML.getElementsByTagName("Body")[0];
-    if (body != null) {
-
-        var fault = body.getElementsByTagName("Fault")[0];
-        if (fault != null) {
-            registryKeyDiv.innerHTML = "<input type='text' id='propertyKey' value='"+selectedValue+"'/>";
-        } else {
-
-            var entries = body.getElementsByTagName("return");
-
-            if (entries.length == 0) {
-                registryKeyDiv.innerHTML = "<label style='width: 200px; text-align: left'>No registry keys found.</label>";
-            } else {
-
-                registryKeyDiv.innerHTML = "<select id='propertyKey'></select>";
-                var keySelect = document.getElementById("propertyKey");
-
-                var i = 0;
-                for (i = 0; i < entries.length; i++) {
-                    var key = entries[i].textContent;
-                    keySelect.options[i] = new Option(key, key);
-
-                    if(key == selectedValue) {
-                        keySelect.options[i].selected = true;
-                    }
-                }
-            }
-        }
-    } else {
-        registryKeyDiv.innerHTML = "<input type='text' id='propertyKey' />";
-    }
-}

Added: esb/java/trunk/modules/distribution/src/main/www/extensions/core/js/root.js
==============================================================================
--- (empty file)
+++ esb/java/trunk/modules/distribution/src/main/www/extensions/core/js/root.js	Fri Feb  2 05:06:27 2007
@@ -0,0 +1,437 @@
+/*
+ * Copyright (c) 2006, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed 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 globalCurrentParent = "";
+
+var EXPANDED = "EXPANDED";
+var COLLAPSED = "COLLAPSED";
+var NOT_AVAILABLE = "NOT_AVAILABLE";
+var expandedImg = new Image();
+expandedImg.src = "extensions/core/images/tree_opened.gif";
+
+var collapsedImg = new Image();
+collapsedImg.src = "extensions/core/images/tree_closed.gif";
+
+var foldercloseImg = new Image();
+foldercloseImg.src = "extensions/core/images/folder_close.gif"
+
+var folderopenImg = new Image();
+folderopenImg.src = "extensions/core/images/folder_open.gif"
+
+var fileImg = new Image();
+fileImg.src = "extensions/core/images/file.gif"
+
+var thisObject = null;
+
+/* root class */
+
+function root(registryDiv, pName){
+
+    // attributes
+
+    this.name = pName;
+    this.rootChildren = new Array();
+    this.regDivName = registryDiv;
+
+    //this.regDataDivName = regDataDiv;
+    this.selected = null;
+    this.populatedFolders = new Array();
+    this.currentParent = null;
+
+    /*
+    user of the root can register a call back function which takes the selected folder path
+    as the parameter
+    */
+    this.folderSelectHandler = null;
+
+    // methods
+
+    this.add = addRootChild;
+    this.write = writeRoot;
+    this.getSelected = getSelectedValue;
+    this.addFolder = addNewFolder;
+    this.getFolder = getFolderOfTree;
+    this.getMatchingChild = getMatchingRootChild;
+    this.expand = expandRootFolder;
+    this.collapse = collapseRootFolder;
+    this.collapseFolder = collapseGivenFolder;
+    this.show = showRoot;
+    this.expanderClick = onExpanderClick;
+    this.populateChildren = populateChildrenRoot;
+    //this.populateChildrenCallback = populateChildrenCallbackRoot;
+    this.containsString = containsStringRoot;
+    this.onFolderClick = onFolderClickRoot;
+    this.registerFolderSelectHandler = registerFolderSelectHandlerRoot;
+    this.reset = resetRoot;
+    //this.showFolder = showFolderRoot;
+    //this.hideFolder = hideFolderRoot;
+
+    this.test = testRoot;
+    thisObject = this;
+}
+
+function resetRoot() {
+
+    this.rootChildren = new Array();
+    this.selected = null;
+    this.populatedFolders = new Array();
+    this.currentParent = null;
+
+    this.show();
+}
+
+/**
+ Display the registry. Expand and highlight the selected value.
+ */
+function showRoot(selectedValue) {
+    this.selected = selectedValue;
+
+    // if root is not populated, populate it
+    if(this.containsString(this.populatedFolders, "")) {
+        this.expand("");
+        this.write();
+    } else {
+        this.populatedFolders[this.populatedFolders.length] = "";
+        this.populateChildren("", this.regDivName, "");
+    }
+}
+
+function getFolderState(folderName) {
+    var folder = this.getFolder(folderName);
+    if(folder != null) {
+        return folder.getState();
+    } else {
+        return NOT_AVAILABLE;
+    }
+}
+
+function registerFolderSelectHandlerRoot(selectHandler) {
+    this.folderSelectHandler = selectHandler;
+}
+
+function collapseGivenFolder(folderName) {
+    var folder = this.getFolder(folderName);
+    if(folder != null) {
+        folder.collapse();
+    }
+}
+
+/**
+ Collapse the folder and all its descendants.
+ */
+function collapseRootFolder() {
+
+    hideFolder(this.path);
+    var numFolders = this.rootChildren.length;
+    for (var i=0;i <numFolders;i++) {
+        this.rootChildren[i].collapse();
+    }
+}
+
+/**
+ Expands to the specified folder. If successors of the given folder are not expanded we have to
+ expand them as well.
+ */
+function expandRootFolder(folder) {
+
+    var rootFolder = this.getMatchingChild(folder);
+
+    if(rootFolder != null) {
+        showFolder(rootFolder.path);
+        var expImg = document.getElementById('E' + folder.path);
+        if(expImg != null) {
+            expImg.src = expandedImg.src;
+        }
+
+        rootFolder.expand(folder);
+    }
+}
+
+function getMatchingRootChild(path) {
+
+    var currentMatch = null;
+
+    var numFolders = this.rootChildren.length;
+    for (var i=0;i <numFolders;i++) {
+        if(path.indexOf(this.rootChildren[i].path) == 0) {
+            if (currentMatch == null) {
+                currentMatch = this.rootChildren[i];
+            } else {
+                if (currentMatch.path.length < this.rootChildren[i].path.length) {
+                    currentMatch = this.rootChildren[i];
+                }
+            }
+        }
+    }
+
+    return currentMatch;
+}
+
+function addRootChild(folder){
+    this.rootChildren[this.rootChildren.length] = folder;
+}
+
+function addNewFolder(parent, newFolder) {
+    var hookFolder = this.getFolder(parent);
+    var childFolder = new folder(parent + '/' + newFolder, newFolder);
+    hookFolder.add(childFolder);
+    this.write();
+}
+
+function getFolderOfTree(path) {
+
+    var entity = this.getMatchingChild(path);
+
+    if(entity == null) {
+        alert("null entity");
+        return null;
+    }
+
+    while(entity.path.length != path.length) {
+
+        entity = entity.getMatchingChild(path);
+
+        if(entity == null) {
+            return null;
+        }
+    }
+
+    return entity;
+}
+
+function getSelectedValue() {
+    return this.selected;
+}
+
+function testRoot() {
+
+    //var treeString;
+    //var numFolders = this.rootChildren.length;
+    //for (var i=0;i <numFolders;i++)
+    //    treeString += this.rootChildren[i].write();
+
+    //showStuffInNewWindow(treeString);
+
+    alert('expanding');
+    this.expanderClick('wso2esb-1.0-alpha-1');
+}
+
+function writeRoot(){
+
+    var treeString = "";
+    //treeString += '<input type="button" value="test" onClick="this.test()" /><br />';
+    var numFolders = this.rootChildren.length;
+    for (var i=0;i <numFolders;i++)
+        treeString += this.rootChildren[i].write();
+
+    var regElement = document.getElementById(this.regDivName);
+
+    //showStuffInNewWindow(treeString);
+
+    regElement.innerHTML = treeString;
+
+    var selectedEntry = document.getElementById('l' + this.selected);
+    if (selectedEntry != null) {
+        selectedEntry.style.backgroundColor = '#9999ff';
+    }
+}
+
+/**
+ We might let users to register handlers here. For now let's implement our code.
+ */
+function onExpanderClick(folderName) {
+
+    var folder = this.getFolder(folderName);
+    if(folder != null) {
+        if(folder.getState() == EXPANDED) {
+            this.collapseFolder(folderName);
+        } else if (folder.getState() == COLLAPSED) {
+            if(this.containsString(this.populatedFolders, folderName)) {
+                this.expand(folderName);
+            } else {
+                this.populatedFolders[this.populatedFolders.length] = folderName;
+                this.populateChildren(folderName, this.regDivName, "test");
+            }
+        }
+    }
+}
+
+function onFolderClickRoot(folder) {
+    var oldEntry = document.getElementById('l' + this.selected);
+    if (oldEntry != null) {
+        oldEntry.style.backgroundColor = '#ffffff';
+    }
+
+    var newEntry = document.getElementById('l' + folder);
+    if (newEntry != null) {
+        newEntry.style.backgroundColor = '#9999ff';
+    }
+
+    this.selected = folder;
+    this.folderSelectHandler(folder);
+}
+
+function populateChildrenRoot(parent, divName, defaultValue) {
+
+    this.currentParent = parent;
+
+    // we have to use a global variable to store the current parent, as this.currentParent member
+    // variable is not available for the call back
+    globalCurrentParent = parent;
+
+    selectedValue = defaultValue;
+
+    var body_xml = '<ns1:getChildren xmlns:ns1="http://org.apache.synapse/xsd">' +
+                   '<parent>' + parent + '</parent>' +
+                   '</ns1:getChildren>';
+
+
+
+    var callURL = serverURL + "/" + "RegistryAdmin" + "/" + "getChildren";
+
+    send("getChildren", body_xml, "", callURL, "", false, populateChildrenCallback);
+}
+
+function populateChildrenCallback() {
+
+    var registryKeyDiv = document.getElementById(thisObject.regDivName);
+
+    var body = xhReq.responseXML.getElementsByTagName("Body")[0];
+
+    if (body != null) {
+
+        var fault = body.getElementsByTagName("Fault")[0];
+        if (fault != null) {
+            registryKeyDiv.innerHTML = "<input type='text' id='propertyKey' value='"+selectedValue+"'/>";
+        } else {
+
+            var entries = body.getElementsByTagName("regEntry");
+
+            if (entries.length == 0) {
+                registryKeyDiv.innerHTML = "<label style='width: 200px; text-align: left'>No registry keys found.</label>";
+            } else {
+
+                if(thisObject == null) {
+
+                    // if thisObject is not created parent should always be root
+                    // so create a new root and add children to root
+                    //thisObject = new root(registryKeyDivName);
+                    //var i = 0;
+                    //for (i = 0; i < entries.length; i++) {
+                    //    var key = entries[i].textContent;
+                    //    var child = new folder(key, key);
+                    //
+                    //    thisObject.add(child);
+                    //}
+
+                } else {
+
+                    if(globalCurrentParent == null || globalCurrentParent == "") {
+
+                        // if parent is not set assume that we are adding to the root
+                        var i = 0;
+                        for (i = 0; i < entries.length; i++) {
+                            var key = entries[i].getElementsByTagName("key")[0].textContent;
+                            var type = entries[i].getElementsByTagName("type")[0].textContent;
+
+                            var child;
+                            if (type == "folder") {
+                                child = new folder(key, key);
+                            } else {
+                                child = new regfile(key, key);
+                            }
+
+                            thisObject.add(child);
+                        }
+
+                    } else {
+
+                        // if parent is set we should get the parent folder and add children to it
+
+                        //alert("getting folder " + globalCurrentParent);
+
+                        var f = thisObject.getFolder(globalCurrentParent);
+                        if(f == null) {
+                            alert("Folder is not available in the file browser.");
+                            return;
+                        }
+
+                        var i = 0;
+                        for (i = 0; i < entries.length; i++) {
+                            var key = entries[i].getElementsByTagName("key")[0].textContent;
+                            var type = entries[i].getElementsByTagName("type")[0].textContent;
+
+                            var child;
+                            if (type == "folder") {
+                                child = new folder(key, key);
+                            } else {
+                                child = new regfile(key, key);
+                            }
+
+                            f.add(child);
+                        }
+                    }
+
+                }
+            }
+        }
+
+        thisObject.write();
+
+        if(globalCurrentParent != null && globalCurrentParent != "") {
+            thisObject.expand(globalCurrentParent);
+        }
+
+    } else {
+        //registryKeyDiv.innerHTML = "<input type='text' id='propertyKey' />";
+    }
+}
+
+/* utility functions */
+
+function showFolder(folder){
+    var objFolder = document.getElementById(folder).style;
+    objFolder.display="block";
+    var objExpanderImg = document.getElementById('E' + folder);
+    objExpanderImg.src = expandedImg.src;
+    var objFolderImg = document.getElementById('FI' + folder);
+    if (objFolderImg != null) {
+        objFolderImg.src = folderopenImg.src;
+    }
+}
+
+function hideFolder(folder){
+    var objFolder = document.getElementById(folder).style;
+    objFolder.display="none";
+    var objExpanderImg = document.getElementById('E' + folder);
+    objExpanderImg.src = collapsedImg.src;
+    var objFolderImg = document.getElementById('FI' + folder);
+    if (objFolderImg != null) {
+        objFolderImg.src = foldercloseImg.src;
+    }
+}
+
+function containsStringRoot(array, string) {
+
+    var i = 0;
+    for(i = 0; i < array.length; i++) {
+        if (array[i] == string)
+            return true;
+    }
+
+    return false;
+}
\ No newline at end of file

Modified: esb/java/trunk/modules/distribution/src/main/www/extensions/core/menu.html
==============================================================================
--- esb/java/trunk/modules/distribution/src/main/www/extensions/core/menu.html	(original)
+++ esb/java/trunk/modules/distribution/src/main/www/extensions/core/menu.html	Fri Feb  2 05:06:27 2007
@@ -33,7 +33,7 @@
             <li><a href="#" onclick="javascript:showProperties(); return false;"
                    class="menu_properties_class" title="Properties Management">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Properties</a>
             </li>
-            <li><a href="#" onclick="javascript:showRegistries(); return false;"
+            <li><a href="#" onclick="javascript:showESBRegistry(); return false;"
                    class="menu_registries_class" title="Registry Management">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Registries</a>
             </li>
             <li><a href="#" onclick="javascript:showSaveConfig(); return false;"

Modified: esb/java/trunk/modules/distribution/src/main/www/extensions/core/xslt/edit_property.xsl
==============================================================================
--- esb/java/trunk/modules/distribution/src/main/www/extensions/core/xslt/edit_property.xsl	(original)
+++ esb/java/trunk/modules/distribution/src/main/www/extensions/core/xslt/edit_property.xsl	Fri Feb  2 05:06:27 2007
@@ -61,7 +61,7 @@
                                 </xsl:when>
                                 <xsl:when test="@key">
                                     <label style='width: 200px; text-align: left'><strong style='color: black'>Registry Key</strong></label>
-                                    <div id = "registryKeySelectBox" />                                   
+                                    <input id="propertyKey" type="hidden" /><div id="propEditRegistryKeyListDiv"><div id="propEditRegistryKeySelectBox"></div><div id="propEditRegistryKeyData"></div></div>
                                 </xsl:when>
                                 <xsl:when test="@value">
                                     <label style='width: 200px; text-align: left'><strong style='color: black'>Property Value</strong></label>




More information about the Esb-java-dev mailing list