[esb-java-dev] svn commit r1909 - trunk/esb/java/modules/distribution/src/main/www/extensions/core/js

svn at wso2.org svn at wso2.org
Thu Apr 19 21:28:26 PDT 2007


Author: ruwan
Date: Thu Apr 19 21:28:18 2007
New Revision: 1909

Modified:
   trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/proxyservices.js
Log:
Proxy service add core unctionality done


Modified: trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/proxyservices.js
==============================================================================
--- trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/proxyservices.js	(original)
+++ trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/proxyservices.js	Thu Apr 19 21:28:18 2007
@@ -136,7 +136,7 @@
         if (stepdiv != null) {
 
             var index = stepdiv.getAttribute("name");
-            if (proxydatacollect["step" + index](stepdiv) == -1) {
+            if (proxydatacollect["step" + index](stepdiv, true) == -1) {
                 return;
             }
         }
@@ -264,7 +264,7 @@
     var actionpanel = document.getElementById("actionpanel");
     var index = stepdiv.getAttribute("name");
 
-    if (proxydatacollect["step" + index](stepdiv) == -1) {
+    if (proxydatacollect["step" + index](stepdiv, true) == -1) {
         return;
     }
 
@@ -283,7 +283,7 @@
     var actionpanel = document.getElementById("actionpanel");
     var index = stepdiv.getAttribute("name");
 
-    if (proxydatacollect["step" + index](stepdiv) == -1) {
+    if (proxydatacollect["step" + index](stepdiv, true) == -1) {
         return;
     }
 
@@ -302,7 +302,7 @@
     var actionpanel = document.getElementById("actionpanel");
     var index = stepdiv.getAttribute("name");
 
-    if (proxydatacollect["step" + index](stepdiv) == -1) {
+    if (proxydatacollect["step" + index](stepdiv, true) == -1) {
         return;
     }
 
@@ -340,7 +340,7 @@
                 + "going to edit.\n Do you want to update those changes if there are any?")) {
 
             if (proxydatacollect["step" + geteditingposition()](
-                    document.getElementById("proxystepdiv" + geteditingposition())) == -1) {
+                    document.getElementById("proxystepdiv" + geteditingposition()), true) == -1) {
                 return;
             }
         }
@@ -374,7 +374,7 @@
 
     var objdiv = document.getElementById("proxystepdiv" + index);
 
-    if (proxydatacollect["step" + index](objdiv) == -1) {
+    if (proxydatacollect["step" + index](objdiv, true) == -1) {
         return;
     }
 
@@ -417,7 +417,7 @@
     var stepdiv = document.getElementById("addproxystep");
 
     if (stepdiv != null) {
-        if (proxydatacollect["step" + stepdiv.getAttribute("name")](stepdiv) == -1) {
+        if (proxydatacollect["step" + stepdiv.getAttribute("name")](stepdiv, true) == -1) {
             return;
         }
     }
@@ -530,17 +530,23 @@
     proxydiv.appendChild(savepanel);
 }
 
-proxydatacollect["step1"] = function collecttargetdata(objdiv) {
+proxydatacollect["step1"] = function collecttargetdata(objdiv, validate) {
 
     var targetstring = "<syn:target";
+    var targetchildstring = "";
     var hacktovalidatetarget = false;
 
+    var insequence;
+    var outsequence;
+    var faultsequence;
+    var endpoint;
+
     if (document.getElementById("proxy_name") != null
             && document.getElementById("proxy_name").value != "") {
         internalmodel.proxyname = document.getElementById("proxy_name").value;
         internalmodel.proxy.setAttribute("name", document.getElementById("proxy_name").value);
     } else if (internalmodel.proxy.getAttribute("name")
-            == null || internalmodel.proxy.getAttribute("name") == "") {
+            == null || internalmodel.proxy.getAttribute("name") == "" && validate) {
         alertWarning("Name is required for an proxy service...\n"
                 + "Please specify a name for the proxy service.");
         return -1;
@@ -549,31 +555,35 @@
     if(document.getElementById("insequence") != null && document.getElementById("insequence").value != "") {
         hacktovalidatetarget = true;
         targetstring += " inSequence='" + document.getElementById("insequence").value + "'";
-    } else {
-        // todo: reg key or anonymous
+    } else if(proxytarget["insequence"]) {
+        hacktovalidatetarget = true;
+        insequence = proxytarget["insequence"];
     }
 
     if(document.getElementById("outsequence") != null && document.getElementById("outsequence").value != "") {
         targetstring += " outSequence='" + document.getElementById("outsequence").value + "'";
-    } else {
-        // todo: regkey and anony if not following error
+    } else if(proxytarget["outsequence"]) {
+        outsequence = proxytarget["outsequence"];
+    } else if(validate) {
         alertWarning("Proxy Service must declare an out sequence for the target");
         return -1;
     }
 
     if(document.getElementById("faultsequence") != null && document.getElementById("faultsequence").value != "") {
         targetstring += " faultSequence='" + document.getElementById("faultsequence").value + "'";
-    } else {
-        // todo: regkey and anony
+    } else if (proxytarget["faultsequence"]) {
+        faultsequence = proxytarget["faultsequence"];
     }
 
     if(document.getElementById("endpoint") != null && document.getElementById("endpoint").value != "") {
         hacktovalidatetarget = true;
         targetstring += " endpoint='" + document.getElementById("endpoint").value + "'";
-    } else {
-        // todo regkey and anony
+    } else if (proxytarget["endpoint"]) {
+        hacktovalidatetarget = true;
+        endpoint = proxytarget["endpoint"];
     }
 
+    if (validate) {
     if (hacktovalidatetarget) {
         
         if (getproxyelements("target").length > 0) {
@@ -581,14 +591,23 @@
         }
         
         targetstring += " xmlns:syn='http://ws.apache.org/ns/synapse'/>";
-        internalmodel.proxy.appendChild(createesbelement(targetstring));
+        var target = createesbelement(targetstring);
+        if(insequence)
+            target.appendChild(insequence);
+        if(outsequence)
+            target.appendChild(outsequence);
+        if(faultsequence)
+            target.appendChild(faultsequence);
+        if(endpoint)
+            target.appendChild(endpoint);
+        internalmodel.proxy.appendChild(target);
     } else {
         alertWarning("Proxy Service must declare either an endpoint or inSequence for the target");
         return -1;
-    }
+    }}
 };
 
-proxydatacollect["step2"] = function collecttransportdata(objdiv) {
+proxydatacollect["step2"] = function collecttransportdata(objdiv, validate) {
 
     var transportstring = "";
     var transports = document.getElementsByName("proxy_transport");
@@ -629,7 +648,7 @@
     setparamindexes();
 };
 
-proxydatacollect["step3"] = function collectqosdata(objdiv) {
+proxydatacollect["step3"] = function collectqosdata(objdiv, validate) {
 
     if (internalmodel.proxy.getElementsByTagName("enableSec").length == 0) {
         if (internalmodel.proxy.getElementsByTagName("syn:enableSec").length != 0) {
@@ -671,7 +690,7 @@
     }
 };
 
-proxydatacollect["step4"] = function collectmiscdata(objdiv) {
+proxydatacollect["step4"] = function collectmiscdata(objdiv, validate) {
 
     if (document.getElementById("startOnLoad").checked) {
         internalmodel.proxy.setAttribute("startOnLoad", "true");
@@ -912,20 +931,29 @@
             + "<td><input type='button' class='panelbutton_default' "
             + "onclick=annonymoussequence('" + value.seqtype + "') value='Save'></td>"
             + "<td></td><td><input type='button' class='panelbutton_cancel' "
-            + "onclick='javascript: addeditwrapper(1); return false;' value='Discard'/></td>"
+            + "onclick='javascript: closesequenceeditor(); return false;' value='Discard'/></td>"
             + "</tr></tbody></table></div>";
 
     yuieditorpanel("WSO2-ESB Sequence Editor", bodyHTML, "Anonymous sequence");
 }
 
+function closesequenceeditor() {
+
+    proxydatacollect["step1"](null, false);
+    addeditwrapper(1);
+}
+
 var proxytarget = new Array();
 
 function annonymoussequence(seqtype) {
   
-    proxytarget[seqtype] = createesbelement("<syn:inSequence xmlns:syn='http://ws.apache.org/ns/synapse'/>").appendChild(internalmodel.sequence);
-    alert(new XMLSerilaizer().serializeToString(createesbelement("<syn:inSequence xmlns:syn='http://ws.apache.org/ns/synapse'/>").appendChild(internalmodel.sequence)));
+    proxytarget[seqtype] = createesbelement("<syn:inSequence xmlns:syn='http://ws.apache.org/ns/synapse'/>");
+    var mediatorlist = internalmodel.sequence.childNodes;
+    for(var i = 0; i < mediatorlist.length; i++) {
+        proxytarget[seqtype].appendChild(mediatorlist[i]);
+    }
 
-    alert(new XMLSerializer().serializeToString(proxytarget[seqtype]));
+    closesequenceeditor();
 }
 
 function registrybrowser() {




More information about the Esb-java-dev mailing list