[Registry-dev] svn commit r17913 - in trunk/registry/modules/webapps/src/main: java/org/wso2/registry/web/actions webapp/admin webapp/admin/ajax webapp/admin/css webapp/admin/images webapp/admin/js

chanaka at wso2.com chanaka at wso2.com
Wed Jun 4 04:19:52 PDT 2008


Author: chanaka
Date: Wed Jun  4 04:19:52 2008
New Revision: 17913
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=17913

Log:
basic wsdl validation added to the UI

Added:
   trunk/registry/modules/webapps/src/main/webapp/admin/images/icon-vlidate.jpg   (contents, props changed)
Modified:
   trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/AssociationTreeViewAction.java
   trunk/registry/modules/webapps/src/main/webapp/admin/ajax/resource-properties.jsp
   trunk/registry/modules/webapps/src/main/webapp/admin/css/main.css
   trunk/registry/modules/webapps/src/main/webapp/admin/js/common.js
   trunk/registry/modules/webapps/src/main/webapp/admin/registry-resources.jsp

Modified: trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/AssociationTreeViewAction.java
URL: http://wso2.org/svn/browse/wso2/trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/AssociationTreeViewAction.java?rev=17913&r1=17912&r2=17913&view=diff
==============================================================================
--- trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/AssociationTreeViewAction.java	(original)
+++ trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/AssociationTreeViewAction.java	Wed Jun  4 04:19:52 2008
@@ -14,14 +14,12 @@
     private String resourcePath;
     private String associationTree = "";
     private int assoIndex = 0;
-    private String parentPath="";
 
     public void execute(HttpServletRequest request) throws RegistryException {
         setRequest(request);
 
         List fatherAsso = provideChildAssociations(resourcePath);
         Iterator ifatherAssofaterAsso = fatherAsso.iterator();
-        parentPath = resourcePath;
         while (ifatherAssofaterAsso.hasNext()) {
             Association asso = (Association) ifatherAssofaterAsso.next();
             createAssociationTree(asso.getDestinationPath(), asso.getAssociationType());
@@ -38,7 +36,7 @@
             String fatherResourceType = father instanceof Collection ? ResourceData.COLLECTION : ResourceData.RESOURCE;
             //infinityLoop.add(new String(path));
             //String infinityLoopItem =
-            List fatherAsso = provideChildAssociations(path,parentPath);
+            List fatherAsso = provideChildAssociations(path);
 
             associationTree += "<div class=\"father-object\" >";
             associationTree += "<ul class=\"tree-row-object\"><li class=\"first\">";
@@ -65,7 +63,12 @@
                 Iterator iAssofaterAsso = fatherAsso.iterator();
                 while (iAssofaterAsso.hasNext()) {
                     Association asso = (Association) iAssofaterAsso.next();
-                    createAssociationTree(asso.getDestinationPath(), asso.getAssociationType());
+
+                    // if path is equal to the destination path, it is a backward association. we are only displaying
+                    // the forward associations here
+                    if (!path.equals(asso.getDestinationPath())) {
+                        createAssociationTree(asso.getDestinationPath(), asso.getAssociationType());
+                    }
                 }
                 associationTree += "</div>";
             }
@@ -102,24 +105,7 @@
 
         return associations;
     }
-    public List provideChildAssociations(String resourcePath,String parentPath) throws RegistryException {
-        List associations = new ArrayList();
-        Registry registry = getRegistry();
-        Resource resource = registry.get(resourcePath);
-        Association[] asso = registry.getAllAssociations(resource.getPath());
-        associations.addAll(Arrays.asList(asso));
 
-        Iterator iTempAsso = associations.iterator();
-        for (int i=0;iTempAsso.hasNext();i++) {
-            Association tempAsso = (Association) iTempAsso.next();
-            if(tempAsso.getSourcePath().equals(parentPath)){
-               associations.remove(i);
-            }
-
-        }
-
-        return associations;
-    }
 
     public String getResourcePath() {
         return resourcePath;

Modified: trunk/registry/modules/webapps/src/main/webapp/admin/ajax/resource-properties.jsp
URL: http://wso2.org/svn/browse/wso2/trunk/registry/modules/webapps/src/main/webapp/admin/ajax/resource-properties.jsp?rev=17913&r1=17912&r2=17913&view=diff
==============================================================================
--- trunk/registry/modules/webapps/src/main/webapp/admin/ajax/resource-properties.jsp	(original)
+++ trunk/registry/modules/webapps/src/main/webapp/admin/ajax/resource-properties.jsp	Wed Jun  4 04:19:52 2008
@@ -1,9 +1,10 @@
 <%@ page import="org.wso2.registry.web.UIConstants" %>
 <%@ page import="org.wso2.registry.web.actions.ResourceDetailsAction" %>
 <%@ page import="org.wso2.registry.web.utils.PropertiesUtil" %>
+<%@ page import="java.util.ArrayList" %>
 <%@ page import="java.util.Iterator" %>
-<%@ page import="java.util.Properties" %>
 <%@ page import="java.util.List" %>
+<%@ page import="java.util.Properties" %>
 <%--
   Created by IntelliJ IDEA.
   User: chathura
@@ -17,8 +18,24 @@
     String resourcePath = (String) request.getSession().getAttribute("resourcePath");
     Properties props = PropertiesUtil.getResourceProperties(resourcePath, request);
 
+    List newProps = new ArrayList();
+    List validationProps = new ArrayList();
+    Iterator iTmpProps = props.keySet().iterator();
+
+
+    while(iTmpProps.hasNext()){
+        Object nameObj=iTmpProps.next();
+        String name = (String) nameObj;
+        if(!name.contains("org.wso2")){
+                    newProps.add(nameObj);
+                } else{
+                    validationProps.add(nameObj);
+                }
+    }
+
+    Iterator iProps = newProps.iterator();
 
-    if (!props.isEmpty()) {
+    if (!newProps.isEmpty()) {
 %>
 <table cellpadding="0" cellspacing="0" border="0" class="data-table" style="width:100%">
     <tr>
@@ -27,7 +44,6 @@
         <th style="width:50px;">Action</th>
     </tr>
     <%
-        Iterator iProps = props.keySet().iterator();
         for (int i = 0; iProps.hasNext(); i++) {
 
             String name = (String) iProps.next();
@@ -37,9 +53,6 @@
                 value = (String) propValues.get(0);
             }
 
-            String safeName = name.replace("\'", "\\\'");
-            safeName = safeName.replace("\"", "\\\"");
-            safeName = safeName.replace(";", "\\;");
     %>
 
 
@@ -66,7 +79,7 @@
             <% if (details.isPutAllowed()) { %>
             <a onclick="showHideCommon('propViewPanel_<%=i%>');showHideCommon('propEditPanel_<%=i%>');$('propName_<%=i%>').focus();" style="cursor:pointer;"><img
                     title="Edit" border="0" align="top" src="/wso2registry/admin/images/icon-edit.gif"/></a>
-            <a onclick="removeProperty('<%=safeName%>');" style="margin-left:5px;cursor:pointer;"><img title="Remove"
+            <a onclick="removeProperty('<%=name%>');" style="margin-left:5px;cursor:pointer;"><img title="Remove"
                                                                                             
                                                                                             border="0" align="top"
                                                                                             src="/wso2registry/admin/images/icon-trash.gif"/></a>

Modified: trunk/registry/modules/webapps/src/main/webapp/admin/css/main.css
URL: http://wso2.org/svn/browse/wso2/trunk/registry/modules/webapps/src/main/webapp/admin/css/main.css?rev=17913&r1=17912&r2=17913&view=diff
==============================================================================
--- trunk/registry/modules/webapps/src/main/webapp/admin/css/main.css	(original)
+++ trunk/registry/modules/webapps/src/main/webapp/admin/css/main.css	Wed Jun  4 04:19:52 2008
@@ -926,3 +926,16 @@
     text-align:center;
     padding:20px;
 }
+.validation-div{
+    background-color:#f5f1d8;
+    padding:10px;
+    border:solid 1px #b69248;
+}
+.validation-div table td{
+    height:30px;
+    text-align:left;
+}
+.validation-div table th{
+    font-weight:bold;
+    text-align:left;
+}

Added: trunk/registry/modules/webapps/src/main/webapp/admin/images/icon-vlidate.jpg
URL: http://wso2.org/svn/browse/wso2/trunk/registry/modules/webapps/src/main/webapp/admin/images/icon-vlidate.jpg?pathrev=17913
==============================================================================
Binary file. No diff available.

Modified: trunk/registry/modules/webapps/src/main/webapp/admin/js/common.js
URL: http://wso2.org/svn/browse/wso2/trunk/registry/modules/webapps/src/main/webapp/admin/js/common.js?rev=17913&r1=17912&r2=17913&view=diff
==============================================================================
--- trunk/registry/modules/webapps/src/main/webapp/admin/js/common.js	(original)
+++ trunk/registry/modules/webapps/src/main/webapp/admin/js/common.js	Wed Jun  4 04:19:52 2008
@@ -1060,3 +1060,6 @@
 	}
 
 }
+function validateWSDL(){
+    showHideCommon('validationDiv');
+}

Modified: trunk/registry/modules/webapps/src/main/webapp/admin/registry-resources.jsp
URL: http://wso2.org/svn/browse/wso2/trunk/registry/modules/webapps/src/main/webapp/admin/registry-resources.jsp?rev=17913&r1=17912&r2=17913&view=diff
==============================================================================
--- trunk/registry/modules/webapps/src/main/webapp/admin/registry-resources.jsp	(original)
+++ trunk/registry/modules/webapps/src/main/webapp/admin/registry-resources.jsp	Wed Jun  4 04:19:52 2008
@@ -1,4 +1,7 @@
-<%@ page import="org.wso2.registry.*" %>
+<%@ page import="org.wso2.registry.Collection" %>
+<%@ page import="org.wso2.registry.Comment" %>
+<%@ page import="org.wso2.registry.RegistryConstants" %>
+<%@ page import="org.wso2.registry.Tag" %>
 <%@ page import="org.wso2.registry.web.UIConstants" %>
 <%@ page import="org.wso2.registry.web.actions.CollectionPagesViewAction" %>
 <%@ page import="org.wso2.registry.web.actions.CollectionViewAction" %>
@@ -6,10 +9,7 @@
 <%@ page import="org.wso2.registry.web.actions.utils.ResourceData" %>
 <%@ page import="org.wso2.registry.web.actions.utils.ResourcePath" %>
 <%@ page import="org.wso2.registry.web.utils.CommonUtil" %>
-<%@ page import="java.util.Iterator" %>
-<%@ page import="java.util.List" %>
-<%@ page import="java.util.Map" %>
-<%@ page import="java.util.Properties" %>
+<%@ page import="java.util.*" %>
 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
 "http://www.w3.org/TR/html4/strict.dtd">
@@ -345,7 +345,24 @@
 
         <%
             Properties props = details.getProperties();
-            if (!props.isEmpty()) {
+            List newProps = new ArrayList();
+            List validationProps = new ArrayList();
+            Iterator iTmpProps = props.keySet().iterator();
+
+
+            while(iTmpProps.hasNext()){
+                Object nameObj=iTmpProps.next();
+                String name = (String) nameObj;
+                if(!name.contains("org.wso2")){
+                    newProps.add(nameObj);
+                } else{
+                    validationProps.add(nameObj);
+                }
+            }
+
+            Iterator iProps = newProps.iterator();
+
+            if (!newProps.isEmpty()) {
         %>
         <table cellpadding="0" cellspacing="0" border="0" class="data-table" style="width:100%;margin-top:0px;">
             <tr>
@@ -355,16 +372,16 @@
             </tr>
             <%
                 }
-                Iterator iProps = props.keySet().iterator();
+
                 for (int i = 0; iProps.hasNext(); i++) {
 
                     String name = (String) iProps.next();
-
-                    String value = "";
-                    List propValues = (List) props.get(name);
-                    if (propValues != null) {
-                        value = (String) propValues.get(0);
-                    }
+                    //if(!name.contains("org.wso2")){
+                        String value = "";
+                        List propValues = (List) props.get(name);
+                        if (propValues != null) {
+                            value = (String) propValues.get(0);
+                        }
 
             %>
 
@@ -402,7 +419,7 @@
 
             <%
                 }
-                if (!props.isEmpty()) {
+                if (!newProps.isEmpty()) {
             %>
         </table>
         <% } %>
@@ -919,10 +936,37 @@
 <br/>
 <a href="/wso2registry/resources<%=details.getContentPath()%>" target="_blank" class="download-link"><img
         src="/wso2registry/admin/images/icon-download.jpg" border="0" align="top"/> Download</a>
-<br/>
-
-<% } %>
+<br/><br/>
+<%
+    String filePath=details.getContentPath();
+    if(filePath.endsWith(".wsdl")){
+%>
+<a onclick="validateWSDL();" target="_blank" class="download-link"><img
+        src="/wso2registry/admin/images/icon-vlidate.jpg" border="0" align="top"/> Validate</a>
 
+<%
+        }
+    } %>
+<div id="validationDiv" class="validation-div" style="display:none;">
+    <table cellpadding="0" cellspacing="0" border="0" style="width:100%">
+    <%
+        Iterator iValidations = validationProps.iterator();
+        while(iValidations.hasNext()){
+            String name = (String) iValidations.next();
+            String value = "";
+            List propValues = (List) props.get(name);
+            if (propValues != null) {
+                value = (String) propValues.get(0);
+            }
+            %>
+            <tr>
+                <th style="width:40%"><%=name%></th><td><%=value%></td>
+            </tr>
+            <%
+        }
+    %>
+        </table>
+</div>
 
 <!-- End box1-mid div -->
 </div>



More information about the Registry-dev mailing list