Author: rajika Date: Tue Mar 17 03:38:56 2009 New Revision: 32157 URL: http://wso2.org/svn/browse/wso2?view=rev&revision=32157
Log: Fixed CARBON-3272, CARBON-3105 Modified: branches/esb/java/2.0.1/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/org/wso2/carbon/endpoints/ui/i18n/Resources.properties branches/esb/java/2.0.1/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/web/endpoints/index.jsp branches/esb/java/2.0.1/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/web/endpoints/statHandler-ajaxprocessor.jsp Modified: branches/esb/java/2.0.1/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/org/wso2/carbon/endpoints/ui/i18n/Resources.properties URL: http://wso2.org/svn/browse/wso2/branches/esb/java/2.0.1/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/org/wso2/carbon/endpoints/ui/i18n/Resources.properties?rev=32157&r1=32156&r2=32157&view=diff ============================================================================== --- branches/esb/java/2.0.1/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/org/wso2/carbon/endpoints/ui/i18n/Resources.properties (original) +++ branches/esb/java/2.0.1/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/org/wso2/carbon/endpoints/ui/i18n/Resources.properties Tue Mar 17 03:38:56 2009 @@ -55,7 +55,7 @@ service.field.cannot.be.empty=Service field cannot be empty port.field.cannot.be.empty=Port field cannot be empty invalid.wsdl.definition.xml.parse.error=Invalid WSDL definition: XML parse error -statistics=Enable Statistics +enable.statistics=Enable Statistics disable.statistics=Disable Statistics please.enter.a.valid.number.to.the.retrydelay.field=Please enter a valid number to the Retry Delay please.enter.a.valid.number.to.the.retry.field=Please enter a valid number to the Retry Modified: branches/esb/java/2.0.1/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/web/endpoints/index.jsp URL: http://wso2.org/svn/browse/wso2/branches/esb/java/2.0.1/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/web/endpoints/index.jsp?rev=32157&r1=32156&r2=32157&view=diff ============================================================================== --- branches/esb/java/2.0.1/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/web/endpoints/index.jsp (original) +++ branches/esb/java/2.0.1/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/web/endpoints/index.jsp Tue Mar 17 03:38:56 2009 @@ -47,198 +47,162 @@ %> <script type="text/javascript"> - //when the DOM is ready execute the methord - YAHOO.util.Event.onDOMReady(init); - String.prototype.trim = function() { - return this.replace(/^\s+|\s+$/g,""); +//when the DOM is ready execute the methord +YAHOO.util.Event.onDOMReady(init); +String.prototype.trim = function() { + return this.replace(/^\s+|\s+$/g, ""); } String.prototype.ltrim = function() { - return this.replace(/^\s+/,""); + return this.replace(/^\s+/, ""); } String.prototype.rtrim = function() { - return this.replace(/\s+$/,""); + return this.replace(/\s+$/, ""); } - function init() { - if ('<%=epMode%>' != null && '<%=epMode%>' == 'anon') { - hideElem('myTable'); - hideElem('noEpLabel'); - showElem('btnRow'); - } - } - - function hideElem(id) { - var elem = document.getElementById(id); - if (elem != undefined) { - elem.style.display = 'none'; - } +function init() { + if ('<%=epMode%>' != null && '<%=epMode%>' == 'anon') { + hideElem('myTable'); + hideElem('noEpLabel'); + showElem('btnRow'); } +} - function showElem(id) { - document.getElementById(id).style.display = ''; +function hideElem(id) { + var elem = document.getElementById(id); + if (elem != undefined) { + elem.style.display = 'none'; } +} - function goBack() { - <% - String anonEpOriginator; - if ((anonEpOriginator = (String)session.getAttribute("anonOriginator")) != null - && !"".equals(anonEpOriginator)) {%> - window.location.href = '<%=anonEpOriginator%>?cancelled=true'; - <%} - %> - } +function showElem(id) { + document.getElementById(id).style.display = ''; +} - function deleteRow(i) { - var table = document.getElementById("myTable"); - var row = table.rows[i]; - var cell = row.cells[0]; - var content = cell.firstChild.nodeValue; - function forwardToDel() { - var tt = "endpointDeleteHandler.jsp?" + "endpointName=" + content.trim(); - document.location.href = tt - } - //var val = confirm("Do you want to delete the endpoint ?"); - CARBON.showConfirmationDialog("<fmt:message key="do.you.want.to.delete.the.endpoint"/>", forwardToDel); - //if(val==true){ - // var tt = "endpointDeleteHandler.jsp?"+"endpointName="+content; - // document.location.href=tt - //} +function goBack() { +<% +String anonEpOriginator; +if ((anonEpOriginator = (String)session.getAttribute("anonOriginator")) != null +&& !"".equals(anonEpOriginator)) {%> + window.location.href = '<%=anonEpOriginator%>?cancelled=true'; +<%} +%> +} +function deleteRow(i) { + var table = document.getElementById("myTable"); + var row = table.rows[i]; + var cell = row.cells[0]; + var content = cell.firstChild.nodeValue; + function forwardToDel() { + var tt = "endpointDeleteHandler.jsp?" + "endpointName=" + content.trim(); + document.location.href = tt } + CARBON.showConfirmationDialog("<fmt:message key="do.you.want.to.delete.the.endpoint"/>", forwardToDel); +} - function editRow(i) { - var table = document.getElementById("myTable"); - var row = table.rows[i]; - var cell = row.cells[0]; - var type = row.cells[1]; - var content = cell.firstChild.nodeValue; - var endType = type.firstChild.nodeValue; - - if (endType.trim() == 'Address Endpoint') { - - var tt = "AddressEndpoint.jsp?" + "endpointName=" + content.trim(); - document.location.href = tt - } - else if (endType.trim() == 'WSDL Endpoint') { - var endT = "wsdlEndpoint.jsp?" + "endpointName=" + content.trim(); - document.location.href = endT - } +function editRow(i) { + var table = document.getElementById("myTable"); + var row = table.rows[i]; + var cell = row.cells[0]; + var type = row.cells[1]; + var content = cell.firstChild.nodeValue; + var endType = type.firstChild.nodeValue; - else if (endType.trim() == 'Failover group') { - var failover = "failoverEditHandler.jsp?" + "endpointName=" + content.trim(); - document.location.href = failover - } - else if (endType.trim() == 'Load-balance group') { - var loadbalance = "loadbalanceEditHandler.jsp?" + "endpointName=" + content.trim(); - document.location.href = loadbalance - } + if (endType.trim() == 'Address Endpoint') { + var tt = "AddressEndpoint.jsp?" + "endpointName=" + content.trim(); + document.location.href = tt + } + else if (endType.trim() == 'WSDL Endpoint') { + var endT = "wsdlEndpoint.jsp?" + "endpointName=" + content.trim(); + document.location.href = endT } - function movetoFailover() { - var endT = "FailoverGroup.jsp?" + "from=" + "index"; - document.location.href = endT; - } - var req; - - function makeStatEnablerCall(endName, eleId, enaDis) { - - /* - var table = document.getElementById("myTable"); - var row = table.rows[i]; - var cell = row.cells[0]; - var type = row.cells[1]; - var content = cell.firstChild.nodeValue; - var endType = type.firstChild.nodeValue; - var eleId = content+endType; - */ - // var diseleId = 'disable'+content+endType; - - //var disele = document.getElementById(disele) - //alert(ele.style.backgroundImage.URL.value); - //alert(ele.style.backgroundImage.URL); - var url; - if (enaDis == 'enable') { - var ele = document.getElementById('disable' + eleId); - ele.style.display = ''; - var hidEle = document.getElementById('enable' + eleId); - hidEle.style.display = 'none'; - url = 'statHandler-ajaxprocessor.jsp?endpointName=' + endName + '&' + 'action=disable' + '&' + 'rowName=' + eleId - - } - else { - var ele = document.getElementById('enable' + eleId); - ele.style.display = ''; - var hidEle = document.getElementById('disable' + eleId); - hidEle.style.display = 'none'; - url = 'statHandler-ajaxprocessor.jsp?endpointName=' + endName + '&' + 'action=enable' + '&' + 'rowName=' + eleId - } - /* - if(ele.src.indexOf('../admin/images/static-icon-disabled.gif')>0){ - ele.src ='../admin/images/static-icon.gif' - url = 'statHandler-ajaxprocessor.jsp?endpointName='+content+'&'+'action=enable'+'&'+'rowName='+eleId - - } - else{ - ele.src='../admin/images/static-icon.gif' - url = 'statHandler-ajaxprocessor.jsp?endpointName='+content+'&'+'action=disable'+'&'+'rowName='+eleId + else if (endType.trim() == 'Failover group') { + var failover = "failoverEditHandler.jsp?" + "endpointName=" + content.trim(); + document.location.href = failover + } + else if (endType.trim() == 'Load-balance group') { + var loadbalance = "loadbalanceEditHandler.jsp?" + "endpointName=" + content.trim(); + document.location.href = loadbalance + } - } +} - */ +function movetoFailover() { + var endT = "FailoverGroup.jsp?" + "from=" + "index"; + document.location.href = endT; +} +var req; +function makeStatEnablerCall(endName, eleId, enaDis) { + var url; + if (enaDis == 'enable') { + var ele = document.getElementById('disable' + eleId); + ele.style.display = 'none'; + var hidEle = document.getElementById('enable' + eleId); + hidEle.style.display = ''; + url = 'statHandler-ajaxprocessor.jsp?endpointName=' + endName + '&' + 'action=enable' + '&' + 'rowName=' + eleId; + } + else if (enaDis == 'disable') { + var ele = document.getElementById('enable' + eleId); + ele.style.display = 'none'; + var hidEle = document.getElementById('disable' + eleId); + hidEle.style.display = ''; + url = 'statHandler-ajaxprocessor.jsp?endpointName=' + endName + '&' + 'action=disable' + '&' + 'rowName=' + eleId; + } + req = false; - req = false; + // branch for native XMLHttpRequest object + if (window.XMLHttpRequest && !(window.ActiveXObject)) { + try { + req = new XMLHttpRequest(); + } catch(e) { + req = false; - // branch for native XMLHttpRequest object - if (window.XMLHttpRequest && !(window.ActiveXObject)) { + } + // branch for IE/Windows ActiveX version + } else if (window.ActiveXObject) { + try { + req = new ActiveXObject("Msxml2.XMLHTTP"); + } catch(e) { try { - req = new XMLHttpRequest(); + req = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { req = false; - } - // branch for IE/Windows ActiveX version - } else if (window.ActiveXObject) { - try { - req = new ActiveXObject("Msxml2.XMLHTTP"); - } catch(e) { - try { - req = new ActiveXObject("Microsoft.XMLHTTP"); - } catch(e) { - req = false; - } - } - } - - if (req) { - req.onreadystatechange = processReqChange; - req.open("GET", url, true); - req.send(""); } - } - function processReqChange() { - // only if req shows "loaded" - if (req.readyState == 4) { - // only if "OK" - if (req.status == 200) { + if (req) { + req.onreadystatechange = processReqChange; + req.open("GET", url, true); + req.send(""); + } +} - } else { - CARBON.showErrorDialog("There was a problem retrieving the XML data:\n" + - req.statusText); - CARBON.showErrorDialog(req.getResponseHeader()) - } +function processReqChange() { + // only if req shows "loaded" + if (req.readyState == 4) { + // only if "OK" + if (req.status == 200) { + + } else { + CARBON.showErrorDialog("There was a problem retrieving the XML data:\n" + + req.statusText); + CARBON.showErrorDialog(req.getResponseHeader()) } } - function redirect(selNode) { - var selected = selNode.options[selNode.selectedIndex].value; - if (selected != "") { - window.location.href = selNode.options[selNode.selectedIndex].value; - } +} + +function redirect(selNode) { + var selected = selNode.options[selNode.selectedIndex].value; + if (selected != "") { + window.location.href = selNode.options[selNode.selectedIndex].value; } +} </script> + <div id="middle"> <h2><fmt:message key="manage.endpoints"/></h2> @@ -277,114 +241,103 @@ %> <div id="noEpLabel"><fmt:message key="no.endpoints.are.currently.defined.click.add.endpoint.to.define.a.new.endpoint"></fmt:message> -<table><tr><td><br></td></tr></table></div> + <table> + <tr> + <td><br></td> + </tr> + </table> +</div> <%}%> - + <%if (endPoints != null) {%> <table id="myTable" border="0" cellspacing="0" cellpadding="0" class="styledLeft"> <thead> - <tr> - <th><fmt:message key="endpoint.name"/></th> - <th><fmt:message key="type"/></th> - <th><fmt:message key="action"/></th> - </tr> + <tr> + <th><fmt:message key="endpoint.name"/></th> + <th><fmt:message key="type"/></th> + <th colspan="3"><fmt:message key="action"/></th> + </tr> </thead> <tbody> - <% - for (EndpointMetaData dao : endPoints) { - EndpointMetaData end = dao; - %> - <tr> - <td><%=end.getName()%> - </td> - <td><%=endpointNames[end.getType()]%> - </td> - <td> - <%if (session.getAttribute(end.getName() + endpointNames[end.getType()]) == null) {%> - <%if ((endpointNames[end.getType()].equalsIgnoreCase("Failover group"))) {%> - <%} else if ((endpointNames[end.getType()].equalsIgnoreCase("Load-balance group"))) {%> - <%} else {%> - <div> - <div id="<%="disable"+end.getName()+endpointNames[end.getType()]%>"> - <a onclick="makeStatEnablerCall('<%=end.getName()%>','<%=end.getName()+endpointNames[end.getType()]%>','disable')" - href="#" class="icon-link" - style="background-image:url(../admin/images/static-icon-disabled.gif;)"> - <fmt:message key="statistics"/></a> - </div> - <div id="<%="enable"+end.getName()+endpointNames[end.getType()]%>" - style="display:none;"> - <a onclick="makeStatEnablerCall('<%=end.getName()%>','<%=end.getName()+endpointNames[end.getType()]%>','enable')" - href="#" class="icon-link" - style="background-image:url(../admin/images/static-icon.gif;)"> - <fmt:message - key="statistics"/></a> - </div> - </div> + <% + for (EndpointMetaData dao : endPoints) { + EndpointMetaData end = dao; + %> + <tr> + <td><%=end.getName()%> + </td> + <td><%=endpointNames[end.getType()]%> + </td> <% - } - } else if (((String) session.getAttribute(end.getName() + endpointNames[end.getType()])).equalsIgnoreCase("disabled")) { + // try reading from the session, if fails try from the back end service + if ((session.getAttribute(end.getName() + endpointNames[end.getType()]) != null && + (((String) session.getAttribute(end.getName() + endpointNames[end.getType()])).equalsIgnoreCase("enabled"))) + || end.getEnableStatistics()) { %> - <%if ((endpointNames[end.getType()].equalsIgnoreCase("Failover group"))) {%> - <%} else if ((endpointNames[end.getType()].equalsIgnoreCase("Load-balance group"))) {%> - <%} else {%> - <div> - <div id="<%="disable"+end.getName()+endpointNames[end.getType()]%>"> - <a onclick="makeStatEnablerCall('<%=end.getName()%>','<%=end.getName()+endpointNames[end.getType()]%>','disable')" - href="#" class="icon-link" - style="background-image:url(../admin/images/static-icon-disabled.gif;)"> - <fmt:message key="statistics"/></a> - </div> - <div id="<%="enable"+end.getName()+endpointNames[end.getType()]%>" - style="display:none;"> - <a onclick="makeStatEnablerCall('<%=end.getName()%>','<%=end.getName()+endpointNames[end.getType()]%>','enable')" - href="#" class="icon-link" - style="background-image:url(../admin/images/static-icon.gif;)"> - <fmt:message - key="statistics"/></a> + <td style="border-right:none;border-left:none;width:200px"> + <div class="inlineDiv"> + <div id="<%="enable"+end.getName()+endpointNames[end.getType()]%>"> + <a onclick="makeStatEnablerCall('<%=end.getName()%>','<%=end.getName()+endpointNames[end.getType()]%>','disable')" + href="#" class="icon-link" + style="background-image:url(../admin/images/static-icon.gif;)"> + <fmt:message + key="disable.statistics"/></a> + </div> + <div id="<%="disable"+end.getName()+endpointNames[end.getType()]%>" + style="display:none;"> + <a onclick="makeStatEnablerCall('<%=end.getName()%>','<%=end.getName()+endpointNames[end.getType()]%>','enable')" + href="#" class="icon-link" + style="background-image:url(../admin/images/static-icon-disabled.gif;)"> + <fmt:message key="enable.statistics"/></a> + </div> + </div> - </div> + </td> <% - } - } else if (((String) session.getAttribute(end.getName() + endpointNames[end.getType()])).equalsIgnoreCase("enabled")) { + } else { %> - <%if ((endpointNames[end.getType()].equalsIgnoreCase("Failover group"))) {%> - <%} else if ((endpointNames[end.getType()].equalsIgnoreCase("Load-balance group"))) {%> - <%} else {%> - <div> - <div id="<%="disable"+end.getName()+endpointNames[end.getType()]%>" - style="display:none;"> - <a onclick="makeStatEnablerCall('<%=end.getName()%>','<%=end.getName()+endpointNames[end.getType()]%>','disable')" - href="#" class="icon-link" - style="background-image:url(../admin/images/static-icon-disabled.gif;)"> - <fmt:message key="statistics"/></a> + <td style="border-right:none;border-left:none;width:200px"> + <div class="inlineDiv"> + <div id="<%="disable"+end.getName()+endpointNames[end.getType()]%>"> + <a onclick="makeStatEnablerCall('<%=end.getName()%>','<%=end.getName()+endpointNames[end.getType()]%>','enable')" + href="#" class="icon-link" + style="background-image:url(../admin/images/static-icon-disabled.gif;)"> + <fmt:message key="enable.statistics"/></a> + </div> + <div id="<%="enable"+end.getName()+endpointNames[end.getType()]%>" + style="display:none;"> + <a onclick="makeStatEnablerCall('<%=end.getName()%>','<%=end.getName()+endpointNames[end.getType()]%>','disable')" + href="#" class="icon-link" + style="background-image:url(../admin/images/static-icon.gif;)"> + <fmt:message + key="disable.statistics"/></a> + </div> </div> - <div id="<%="enable"+end.getName()+endpointNames[end.getType()]%>"> - <a onclick="makeStatEnablerCall('<%=end.getName()%>','<%=end.getName()+endpointNames[end.getType()]%>','enable')" - href="#" class="icon-link" - style="background-image:url(../admin/images/static-icon.gif;)"> - <fmt:message - key="statistics"/></a> + </td> + + <%} %> + <td style="border-left:none;border-right:none;width:100px"> + <div class="inlineDiv"> + <a onclick="editRow(this.parentNode.parentNode.parentNode.rowIndex)" href="#" + class="icon-link" + style="background-image:url(../admin/images/edit.gif);"><fmt:message + key="edit"/></a> </div> - </div> - <% - } - } - %> - <a onclick="editRow(this.parentNode.parentNode.rowIndex)" href="#" - class="icon-link" - style="background-image:url(../admin/images/edit.gif);"><fmt:message - key="edit"/></a> - <a onclick="deleteRow(this.parentNode.parentNode.rowIndex)" href="#" - class="icon-link" - style="background-image:url(../admin/images/delete.gif);"><fmt:message - key="delete"/></a> - </td> - </tr> + </td> + <td style="border-left:none;width:100px"> + <div class="inlineDiv"> + <a onclick="deleteRow(this.parentNode.parentNode.parentNode.rowIndex)" href="#" + class="icon-link" + style="background-image:url(../admin/images/delete.gif);"><fmt:message + key="delete"/></a> + </div> + </td> + </tr> - <%}%> + <%}%> </tbody> </table> @@ -427,16 +380,18 @@ </a> </td> </tr> - <tr><td><br></td></tr> + <tr> + <td><br></td> + </tr> <tr id="btnRow" style="display:none"> <td colspan="2" class="buttonRow"> - <input id="cancelBtn" type="button" value="<fmt:message key="back"/>" class="button" onclick="goBack();return false"/> + <input id="cancelBtn" type="button" value="<fmt:message key="back"/>" class="button" + onclick="goBack();return false"/> </td> </tr> </table> - </div> </div> </div> Modified: branches/esb/java/2.0.1/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/web/endpoints/statHandler-ajaxprocessor.jsp URL: http://wso2.org/svn/browse/wso2/branches/esb/java/2.0.1/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/web/endpoints/statHandler-ajaxprocessor.jsp?rev=32157&r1=32156&r2=32157&view=diff ============================================================================== --- branches/esb/java/2.0.1/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/web/endpoints/statHandler-ajaxprocessor.jsp (original) +++ branches/esb/java/2.0.1/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/web/endpoints/statHandler-ajaxprocessor.jsp Tue Mar 17 03:38:56 2009 @@ -18,6 +18,7 @@ <%@ page import="org.wso2.carbon.endpoint.ui.client.EndpointAdminClient" %> <%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %> <%@ page import="org.wso2.carbon.utils.ServerConstants" %> +<%@ page import="org.wso2.carbon.endpoint.tos.xsd.EndpointMetaData" %> <%! public void doGet(HttpServletRequest req, HttpServletResponse res) { @@ -36,21 +37,19 @@ (ConfigurationContext) config.getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT); String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE); EndpointAdminClient client = new EndpointAdminClient(cookie, url, configContext); + EndpointMetaData[] endpoints = client.getEndpointMetaData(); if (action.equalsIgnoreCase("enable")) { + System.out.println("enabling stats"); session.setAttribute(rowId, "enabled"); client.enableStatistics(name); - - } else { + System.out.println("disabling stats"); session.setAttribute(rowId, "disabled"); client.disableStatistics(name); - } - } catch (Exception e) { - } } %> _______________________________________________ Esb-java-dev mailing list [email protected] https://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev
