Author: ruwan
Date: Fri May 16 03:30:08 2008
New Revision: 17118

Log:
Adding the router mediator UI

Added:
   
branches/esb/java/1.7/esb/java/modules/distribution/src/main/www/extensions/core/js/mediators/router_mediator.js
   (contents, props changed)
   
branches/esb/java/1.7/esb/java/modules/distribution/src/main/www/extensions/core/xslt/mediators/router_edit.xsl
   (contents, props changed)
   
branches/esb/java/1.7/esb/java/modules/distribution/src/main/www/extensions/core/xslt/mediators/router_view.xsl
   (contents, props changed)
Modified:
   
branches/esb/java/1.7/esb/java/modules/distribution/src/main/www/extensions/core/css/wso2-esb.css
   
branches/esb/java/1.7/esb/java/modules/distribution/src/main/www/extensions/core/js.html
   
branches/esb/java/1.7/esb/java/modules/distribution/src/main/www/extensions/core/js/mediators/mediators.js
   
branches/esb/java/1.7/esb/java/modules/distribution/src/main/www/extensions/core/xslt/mediators/custom_mediator_includes.xsl

Modified: 
branches/esb/java/1.7/esb/java/modules/distribution/src/main/www/extensions/core/css/wso2-esb.css
==============================================================================
--- 
branches/esb/java/1.7/esb/java/modules/distribution/src/main/www/extensions/core/css/wso2-esb.css
   (original)
+++ 
branches/esb/java/1.7/esb/java/modules/distribution/src/main/www/extensions/core/css/wso2-esb.css
   Fri May 16 03:30:08 2008
@@ -2234,6 +2234,10 @@
     background: url( ../images/smooks-small.gif ) no-repeat 2px;
 }
 
+li#route {
+    background: url( ../images/router-small.gif ) no-repeat 2px;
+}
+
 li#pojoCommand {
     background: url( ../images/command-small.gif ) no-repeat 2px;
 }

Modified: 
branches/esb/java/1.7/esb/java/modules/distribution/src/main/www/extensions/core/js.html
==============================================================================
--- 
branches/esb/java/1.7/esb/java/modules/distribution/src/main/www/extensions/core/js.html
    (original)
+++ 
branches/esb/java/1.7/esb/java/modules/distribution/src/main/www/extensions/core/js.html
    Fri May 16 03:30:08 2008
@@ -42,6 +42,7 @@
 <script language="javascript" 
src="extensions/core/js/mediators/smooks_mediator.js"></script>
 <script language="javascript" 
src="extensions/core/js/mediators/aggregate_mediator.js"></script>
 <script language="javascript" 
src="extensions/core/js/mediators/callout_mediator.js"></script>
+<script language="javascript" 
src="extensions/core/js/mediators/router_mediator.js"></script>
 <script language="javascript" 
src="extensions/core/js/mediators/property.js"></script>
 <script language="javascript" 
src="extensions/core/js/mediators/mediators.js"></script>
 <script language="javascript" src="extensions/core/js/statistics.js"></script>

Modified: 
branches/esb/java/1.7/esb/java/modules/distribution/src/main/www/extensions/core/js/mediators/mediators.js
==============================================================================
--- 
branches/esb/java/1.7/esb/java/modules/distribution/src/main/www/extensions/core/js/mediators/mediators.js
  (original)
+++ 
branches/esb/java/1.7/esb/java/modules/distribution/src/main/www/extensions/core/js/mediators/mediators.js
  Fri May 16 03:30:08 2008
@@ -22,7 +22,7 @@
 
 var mediatorcategories = [{text: "Core", id: "core", submenu: {id: "coremenu", 
itemdata: [{text: "Drop", id: "drop"}, {text: "Log", id: "log"}, {text: 
"Property", id: "property"}, {text: "Send", id: "send"}, {text: "Sequence", id: 
"sequence"}, {text: "DBreport", id: "dbreport"}, {text: "Callout", id: 
"callout"}, {text: "DBlookup", id: "dblookup"}, {text: "Clone", id: "clone"}, 
{text: "Iterate", id: "iterate"}, {text: "Aggregate", id: "aggregate"}, {text: 
"Cache", id: "cache"}]}},
     {text: "Transform", id: "transform", submenu: {id: "transformmenu", 
itemdata: [{text: "Fault", id: "makefault"}, {text: "Header", id: "header"}, 
{text: "XSLT", id: "xslt"},{text: "XQuery", id: "xquery"},{text: "Smooks", id: 
"smooks"}]}},
-    {text: "Filters", id: "filters", submenu: {id: "filtersmenu", itemdata: 
[{text: "Filter", id: "filter"}, {text: "In", id: "in"}, {text: "Out", id: 
"out"}, {text: "Switch", id: "switch"}, {text: "Validate", id: "validate"}, 
{text: "Throttle", id: "throttle"}]}},
+    {text: "Filters", id: "filters", submenu: {id: "filtersmenu", itemdata: 
[{text: "Filter", id: "filter"}, {text: "In", id: "in"}, {text: "Out", id: 
"out"}, {text: "Switch", id: "switch"}, {text: "Router", id: "router"}, {text: 
"Validate", id: "validate"}, {text: "Throttle", id: "throttle"}]}},
     {text: "Extension", id: "extension", submenu: {id: "extensionmenu", 
itemdata: [{text: "Class", id: "class"}, {text: "Command", id: "pojoCommand"}, 
{text: "Script", id: "script"}, {text: "Spring", id: "spring"}, {text: 
"RMSequence", id: "RMSequence"}]}}];
 
 var parentmediator = " in out filter try ";

Added: 
branches/esb/java/1.7/esb/java/modules/distribution/src/main/www/extensions/core/js/mediators/router_mediator.js
==============================================================================
--- (empty file)
+++ 
branches/esb/java/1.7/esb/java/modules/distribution/src/main/www/extensions/core/js/mediators/router_mediator.js
    Fri May 16 03:30:08 2008
@@ -0,0 +1,90 @@
+/*
+ * 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.
+ */
+
+/**
+ * This js file is for the router mediator specific UI operations
+ */
+
+initedit["router"] = function initrouteredit(mediator) {
+
+    var targets = mediator.getElementsByTagName("syn:target");
+    if (targets.length == 0) {
+        targets = mediator.getElementsByTagName("target");
+    }
+
+    for (var i=0; i<targets.length; i++) {
+        var target_position = targets[i].getAttribute("esb_med_pos");
+        targets[i].setAttribute("tg_pos", 
parseInt(target_position.substring(target_position.lastIndexOf(".") + 1, 
target_position.length)) + 1);
+    }
+
+    var routes = mediator.getElementsByTagName("syn:route");
+    if (routes.length == 0) {
+        routes = mediator.getElementsByTagName("route");
+    }
+
+    for (var j=0; j<routes.length; j++) {
+        var route_position = routes[j].getAttribute("esb_med_pos");
+        routes[j].setAttribute("rt_pos", 
parseInt(route_position.substring(route_position.lastIndexOf(".") + 1, 
route_position.length)) + 1);
+    }
+}
+
+collectdata["router"] = function collectrouterdata(mediator, validate) {
+
+    var cont_par = document.getElementById("continueAfter").value;
+    mediator.setAttribute("continueAfter", cont_par);
+
+    var routes = mediator.getElementsByTagName("syn:route");
+    if (routes.length == 0) {
+        routes = mediator.getElementsByTagName("route");
+    }
+
+    for (var j=0; j<routes.length; j++) {
+        var route_position = routes[j].getAttribute("rt_pos");
+        var expression = document.getElementById("route_expr" + 
route_position);
+        if (expression != undefined && expression != null && expression.value 
!= undefined) {
+            routes[j].setAttribute("expression", expression.value);
+        }
+        var match = document.getElementById("route_match" + route_position);
+        if (match != undefined && match != null && match.value != undefined) {
+            routes[j].setAttribute("match", match.value);
+        }
+        var routebreak = document.getElementById("route_break" + 
route_position);
+        if (routebreak != undefined && routebreak != null && routebreak.value 
!= undefined) {
+            routes[j].setAttribute("breakRouter", routebreak.value);
+        }
+
+        collectmedtargetdata(routes[j]);
+    }
+
+    return true;
+};
+
+mediatorelementstring["router"] = function routerstring() {
+    return "<syn:router xmlns:syn='http://ws.apache.org/ns/synapse'/>";
+};
+
+function addroute() {
+    var position = geteditingmediatorposition();
+    var mediator = getnestedmediator(internalmodel.sequence, position);
+
+    collectdata[mediator.nodeName.substring(mediator.nodeName.indexOf(":") + 
1, mediator.nodeName.length)](mediator, true);
+
+    mediator.appendChild(createesbelement("<syn:route 
xmlns:syn='http://ws.apache.org/ns/synapse'><syn:target 
editing='true'/></syn:route>"));
+
+    setnodepositions(mediator, position);
+
+    editmediator(position);
+}
\ No newline at end of file

Modified: 
branches/esb/java/1.7/esb/java/modules/distribution/src/main/www/extensions/core/xslt/mediators/custom_mediator_includes.xsl
==============================================================================
--- 
branches/esb/java/1.7/esb/java/modules/distribution/src/main/www/extensions/core/xslt/mediators/custom_mediator_includes.xsl
        (original)
+++ 
branches/esb/java/1.7/esb/java/modules/distribution/src/main/www/extensions/core/xslt/mediators/custom_mediator_includes.xsl
        Fri May 16 03:30:08 2008
@@ -27,6 +27,7 @@
     <xsl:include href="aggregate_view.xsl"/>
     <xsl:include href="callout_view.xsl"/>
     <xsl:include href="smooks_view.xsl"/>
+    <xsl:include href="router_view.xsl"/>    
 
 
     <!-- Your custom mediator view xslt references goes here -->

Added: 
branches/esb/java/1.7/esb/java/modules/distribution/src/main/www/extensions/core/xslt/mediators/router_edit.xsl
==============================================================================
--- (empty file)
+++ 
branches/esb/java/1.7/esb/java/modules/distribution/src/main/www/extensions/core/xslt/mediators/router_edit.xsl
     Fri May 16 03:30:08 2008
@@ -0,0 +1,130 @@
+<!--
+  ~ 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.
+  -->
+
+<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
+
+    <xsl:include href="target_edit.xsl"/>
+
+    <xsl:template match="syn:router" 
xmlns:syn="http://ws.apache.org/ns/synapse";>
+        <div id="clone_edit_div">
+            <label class="content-header">
+                <img align="top" src="extensions/core/images/router-big.gif"/>
+                <xsl:text>Router Mediator</xsl:text>
+            </label>
+           <!--<div id="clone_edit_body">-->
+            <table border="0" cellpadding="0" cellspacing="0" 
class="data-table">
+            <tbody>
+                <tr>
+                    <td style="width: 200px;">
+                        Continue after
+                    </td>
+                    <td>
+                        <select id="continueAfter" class="esb-edit" 
style="width: 80px;">
+                            <xsl:if test="@continueAfter='true'">
+                                <option value="true" 
selected="true">True</option>
+                                <option value="false">False</option>
+                            </xsl:if>
+                            <xsl:if test="not(@continueAfter) or 
@continueAfter='false'">
+                                <option value="true">True</option>
+                                <option value="false" 
selected="true">False</option>
+                            </xsl:if>
+                        </select>
+                    </td>
+                </tr>
+            </tbody>
+        </table>
+        <div class="subtitle">Routes</div>
+            <xsl:for-each select="syn:route">
+
+                        <label class="sub-small-title">Route information of 
the route<xsl:value-of
+                            select="@rt_pos"/></label>
+
+                    <a id="panel_delete" title="Delete">
+                        <xsl:attribute name="href">#mediatordiv<xsl:value-of 
select="@esb_med_pos"/></xsl:attribute>
+                        <xsl:attribute 
name="onclick">javascript:deletemediator('<xsl:value-of 
select="@esb_med_pos"/>'); return false;</xsl:attribute>
+                        <img src="extensions/core/images/delete.gif"/>
+                    </a>
+                <br/>
+                <div class="popup-box">
+                <table border="0" cellpadding="0" cellspacing="0" 
class="data-table">
+                    <tbody>
+                        <tr>
+                            <td style="width: 200px;">
+                                XPath Expression
+                            </td>
+                            <td>
+                                <input type="text" class="esb-edit" 
style="width: 200px;">
+                                    <xsl:attribute name="id"><xsl:value-of 
select="concat('route_expr', @rt_pos)"/></xsl:attribute>
+                                    <xsl:if test="@expression">
+                                        <xsl:attribute 
name="value"><xsl:value-of select="@expression"/></xsl:attribute>
+                                    </xsl:if>
+                                </input>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td style="width: 200px;">
+                                Regular Expression
+                            </td>
+                            <td>
+                                <input type="text" class="esb-edit" 
style="width: 200px;">
+                                    <xsl:attribute name="id"><xsl:value-of 
select="concat('route_match', @rt_pos)"/></xsl:attribute>
+                                    <xsl:if test="@match">
+                                        <xsl:attribute 
name="value"><xsl:value-of select="@match"/></xsl:attribute>
+                                    </xsl:if>
+                                </input>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td style="width: 200px;">
+                                Break Route
+                            </td>
+                            <td>
+                                <select class="esb-edit" style="width: 80px;">
+                                    <xsl:attribute name="id"><xsl:value-of 
select="concat('route_break', @rt_pos)"/></xsl:attribute>
+                                    <xsl:if test="@breakRouter='true'">
+                                        <option value="true" 
selected="true">True</option>
+                                        <option value="false">False</option>
+                                    </xsl:if>
+                                    <xsl:if test="not(@breakRouter) or 
@breakRouter='false'">
+                                        <option value="true">True</option>
+                                        <option value="false" 
selected="true">False</option>
+                                    </xsl:if>
+                                </select>
+                            </td>
+                        </tr>
+                    </tbody>
+                </table>
+
+                    <xsl:for-each select="syn:target">
+                        <xsl:attribute name="id">
+                            <xsl:value-of select="@esb_med_pos"/>
+                        </xsl:attribute>
+                        <xsl:call-template name="syn-target-edit">
+                            <xsl:with-param name="external" select="1"/>
+                        </xsl:call-template>
+                    </xsl:for-each>
+                </div>
+            </xsl:for-each><br/>
+
+
+            <input type="button" value="Add Route" onclick="javascript: 
addroute(); return false;" style="width:100px;" class="panelbutton_default"/>
+            <br/>
+            <!--</div>-->
+        </div>
+    </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Added: 
branches/esb/java/1.7/esb/java/modules/distribution/src/main/www/extensions/core/xslt/mediators/router_view.xsl
==============================================================================
--- (empty file)
+++ 
branches/esb/java/1.7/esb/java/modules/distribution/src/main/www/extensions/core/xslt/mediators/router_view.xsl
     Fri May 16 03:30:08 2008
@@ -0,0 +1,114 @@
+<!--
+  ~ 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.
+  -->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
+
+    <xsl:template match="syn:router" mode="custom" priority="2"
+                  xmlns:syn="http://ws.apache.org/ns/synapse";>
+        <label class="content-header">
+            <img align="top" src="extensions/core/images/router-big.gif"/>
+            <xsl:text> Router Mediator</xsl:text>
+        </label>
+
+        <div id="common_table_content">
+            <table border="0" cellpadding="0" cellspacing="0" 
class="data-table">
+                <tbody>
+                    <tr>
+                        <th>Property</th>
+                        <th>Value</th>
+                    </tr>
+                    <tr>
+                        <td>
+                            <label class="log-attribute-name">Continue 
after</label>
+                        </td>
+                        <td>
+                            <label class="log-attribute-value">
+                                <xsl:choose>
+                                    <xsl:when test="@continueAfter">
+                                        <xsl:value-of select="@continueAfter"/>
+                                    </xsl:when>
+                                    <xsl:otherwise>false</xsl:otherwise>
+                                </xsl:choose>
+                            </label>
+                        </td>
+                    </tr>
+                </tbody>
+            </table>
+        </div>
+
+        <xsl:for-each select="syn:route">
+
+            <br/>
+            <label style="margin-left:10px; font-weight: 400;">Route 
information for the Route <xsl:value-of
+                        select="@rt_pos"/></label>
+            <br/>
+            <div id="common_table_content">
+            <table border="0" cellpadding="0" cellspacing="0" 
class="data-table">
+                <tbody>
+                    <tr>
+                        <th>Property</th>
+                        <th>Value</th>
+                    </tr>
+                    <tr>
+                        <td>
+                            <label class="log-attribute-name">XPath 
Expression</label>
+                        </td>
+                        <td>
+                            <label class="log-attribute-value">
+                                <xsl:value-of select="@expression"/>
+                            </label>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>
+                            <label class="log-attribute-name">Regular 
Expression</label>
+                        </td>
+                        <td>
+                            <label class="log-attribute-value">
+                                <xsl:value-of select="@match"/>
+                            </label>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>
+                            <label class="log-attribute-name">Break 
Route</label>
+                        </td>
+                        <td>
+                            <label class="log-attribute-value">
+                                <xsl:choose>
+                                    <xsl:when test="@breakRouter">
+                                        <xsl:value-of select="@breakRouter"/>
+                                    </xsl:when>
+                                    <xsl:otherwise>false</xsl:otherwise>
+                                </xsl:choose>
+                            </label>
+                        </td>
+                    </tr>
+                </tbody>
+            </table>
+        </div>
+            
+        <xsl:for-each select="syn:target">
+            <br/>
+            <label style="margin-left:10px; font-weight: 400;">Target 
information for the route</label>
+            <br/>
+            <xsl:call-template name="syn-target-view"/>
+        </xsl:for-each>
+        </xsl:for-each>
+
+    </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

_______________________________________________
Esb-java-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev

Reply via email to