[Registry-dev] svn commit r16771 - in trunk/registry/modules: core/src/main/java/org/wso2/registry/jdbc core/src/main/java/org/wso2/registry/jdbc/dao core/src/main/java/org/wso2/registry/utils core/src/test/java/org/wso2/registry/jdbc webapps/src/main/java/org/wso2/registry/web webapps/src/main/java/org/wso2/registry/web/utils webapps/src/main/webapp/admin webapps/src/main/webapp/admin/js

svn at wso2.org svn at wso2.org
Sat May 10 12:22:16 PDT 2008


Author: chathura
Date: Sat May 10 04:26:51 2008
New Revision: 16771

Log:

Integrating the versioning support to the UI.
Added functionality to manually create versions.



Modified:
   trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/Repository.java
   trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/dao/ResourceDAO.java
   trunk/registry/modules/core/src/main/java/org/wso2/registry/utils/RegistryUtils.java
   trunk/registry/modules/core/src/test/java/org/wso2/registry/jdbc/VersionHandlingTest.java
   trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/ControllerServlet.java
   trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/utils/ResourcesUtil.java
   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/core/src/main/java/org/wso2/registry/jdbc/Repository.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/Repository.java	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/Repository.java	Sat May 10 04:26:51 2008
@@ -148,10 +148,17 @@
             // resource already exists. try to update the resource
             update(resourceID, purePath, resource);
 
+            if (((ResourceImpl) resource).isVersionableChange()) {
+                resourceDAO.markDirty(resourceID);
+            }
+
         } else {
 
             // resource does not exists. add the resource.
             add(purePath, resource);
+
+            String parentPath = RegistryUtils.getParentPath(purePath);
+            resourceDAO.markDirtyByPath(parentPath);
         }
     }
 
@@ -200,6 +207,9 @@
             throw new RegistryException(msg, e);
         }
 
+        String parentPath = RegistryUtils.getParentPath(purePath);
+        resourceDAO.markDirtyByPath(parentPath);
+
         return purePath;
     }
 
@@ -228,6 +238,11 @@
             throw new AuthorizationFailedException(msg);
         }
 
+        String parentPath = RegistryUtils.getParentPath(path);
+
+        // parent collection gets dirty when a resource is deleted from it
+        resourceDAO.markDirtyByPath(parentPath);
+
         resourceDAO.deleteSubtree(resourceID);
     }
 
@@ -245,7 +260,7 @@
     public String rename(String oldPath, String newName) throws RegistryException {
 
         oldPath = RegistryUtils.getPureResourcePath(oldPath);
-        
+
         String newPath = oldPath.substring(
                 0, oldPath.lastIndexOf(RegistryConstants.PATH_SEPARATOR) + 1) + newName;
 

Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/dao/ResourceDAO.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/dao/ResourceDAO.java	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/dao/ResourceDAO.java	Sat May 10 04:26:51 2008
@@ -370,10 +370,6 @@
         if (resourceImpl.isPropertiesModified()) {
             updateProperties(resourceImpl);
         }
-
-        if (resourceImpl.isVersionableChange()) {
-            setEquivalentVersion(resourceID, -1);
-        }
     }
 
     public int getEquivalentVersion(String resourceID) throws RegistryException {
@@ -405,16 +401,17 @@
         return equivalentVersion;
     }
 
-    public void setEquivalentVersion(String resourceID, int equivalentVersion)
-            throws RegistryException {
+    public void markDirty(String resourceID) throws RegistryException {
 
         Connection conn = Transaction.getConnection();
 
         try {
-            String sql = "UPDATE RESOURCE SET EQUIVALENT_VERSION=? WHERE RID=?";
+            String sql = "UPDATE RESOURCE SET EQUIVALENT_VERSION=?, ASSOCIATED_SNAPSHOT_ID=? " +
+                    "WHERE RID=?";
             PreparedStatement ps = conn.prepareStatement(sql);
-            ps.setInt(1, equivalentVersion);
-            ps.setString(2, resourceID);
+            ps.setLong(1, -1);
+            ps.setLong(2, -1);
+            ps.setString(3, resourceID);
             ps.executeUpdate();
             ps.close();
 
@@ -425,7 +422,6 @@
             log.error(msg, e);
             throw new RegistryException(msg, e);
         }
-
     }
 
     public void delete(String resourceID) throws RegistryException {
@@ -879,8 +875,6 @@
             log.error(msg, e);
             throw new RegistryException(msg, e);
         }
-
-        setEquivalentVersion(parentID, -1);
     }
 
     private void addProperties(Resource resource) throws RegistryException {
@@ -1282,4 +1276,27 @@
         }
 
     }
+
+    public void markDirtyByPath(String resourcePath) throws RegistryException {
+
+        Connection conn = Transaction.getConnection();
+
+        try {
+            String sql = "UPDATE RESOURCE SET EQUIVALENT_VERSION=?, ASSOCIATED_SNAPSHOT_ID=? " +
+                    "WHERE PATH=?";
+            PreparedStatement ps = conn.prepareStatement(sql);
+            ps.setLong(1, -1);
+            ps.setLong(2, -1);
+            ps.setString(3, resourcePath);
+            ps.executeUpdate();
+            ps.close();
+
+        } catch (SQLException e) {
+
+            String msg = "Failed to update the equivalent version of the resource " +
+                    resourcePath + ". " + e.getMessage();
+            log.error(msg, e);
+            throw new RegistryException(msg, e);
+        }
+    }
 }

Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/utils/RegistryUtils.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/utils/RegistryUtils.java	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/utils/RegistryUtils.java	Sat May 10 04:26:51 2008
@@ -166,4 +166,17 @@
 
         return found;
     }
+
+     public static boolean containsAsSubstring(String value, String[] array) {
+
+        boolean found = false;
+
+        for (int i = 0; i < array.length; i++) {
+            if (array[i].indexOf(value) != -1) {
+                found = true;
+            }
+        }
+
+        return found;
+    }
 }

Modified: trunk/registry/modules/core/src/test/java/org/wso2/registry/jdbc/VersionHandlingTest.java
==============================================================================
--- trunk/registry/modules/core/src/test/java/org/wso2/registry/jdbc/VersionHandlingTest.java	(original)
+++ trunk/registry/modules/core/src/test/java/org/wso2/registry/jdbc/VersionHandlingTest.java	Sat May 10 04:26:51 2008
@@ -21,6 +21,7 @@
 
 import junit.framework.TestCase;
 import org.wso2.registry.*;
+import org.wso2.registry.utils.RegistryUtils;
 import org.wso2.registry.jdbc.realm.RegistryRealm;
 import org.wso2.registry.jdbc.utils.RegistryDataSource;
 
@@ -364,4 +365,34 @@
         Resource c1e3 = registry.get("/test/v14/c1");
         assertEquals("Permalink incorrect", c1e3.getPermanentPath(), c1Versions[1]);
     }
+
+    public void testRootLevelVersioning() throws RegistryException {
+
+        Resource r1 = registry.newResource();
+        r1.setContent("r1c1");
+        registry.put("/vtr1", r1);
+
+        registry.createVersion("/");
+
+        Collection c2 = registry.newCollection();
+        registry.put("/vtc2", c2);
+
+        registry.createVersion("/");
+
+        String[] rootVersions = registry.getVersions("/");
+
+        Collection rootv0 = (Collection) registry.get(rootVersions[0]);
+        String[] rootv0Choldren = (String[]) rootv0.getContent();
+        assertTrue("Root should have child vtr1",
+                RegistryUtils.containsAsSubstring("/vtr1", rootv0Choldren));
+        assertTrue("Root should have child vtc2",
+                RegistryUtils.containsAsSubstring("/vtc2", rootv0Choldren));
+
+        Collection rootv1 = (Collection) registry.get(rootVersions[1]);
+        String[] rootv1Choldren = (String[]) rootv1.getContent();
+        assertTrue("Root should have child vtr1",
+                RegistryUtils.containsAsSubstring("/vtr1", rootv1Choldren));
+        assertFalse("Root should not have child vtc2",
+                RegistryUtils.containsAsSubstring("/vtc2", rootv1Choldren));
+    }
 }

Modified: trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/ControllerServlet.java
==============================================================================
--- trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/ControllerServlet.java	(original)
+++ trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/ControllerServlet.java	Sat May 10 04:26:51 2008
@@ -162,6 +162,11 @@
 
                 TagUtil.tag(request, response);
 
+            } else if (command.equals("/createVersion")) {
+
+                ResourcesUtil.createVersion(request, response);
+
+
             } else if (command.equals("/tag")) {
 
                 AddTagAction addTagAction = new AddTagAction();

Modified: trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/utils/ResourcesUtil.java
==============================================================================
--- trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/utils/ResourcesUtil.java	(original)
+++ trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/utils/ResourcesUtil.java	Sat May 10 04:26:51 2008
@@ -29,6 +29,7 @@
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.ServletException;
 import java.io.IOException;
+import java.io.PrintWriter;
 
 public class ResourcesUtil {
 
@@ -150,4 +151,42 @@
     private static void setErrorMessage(HttpServletRequest request, String message) {
         request.getSession().setAttribute(UIConstants.ERROR_MESSAGE, message);
     }
+
+    public static void createVersion(HttpServletRequest request, HttpServletResponse response) {
+
+        String resourcePath = request.getParameter("resourcePath");
+        String responseHTML = "Failed to create a version of resource " + resourcePath;
+
+        try {
+            UserRegistry userRegistry = CommonUtil.getUserRegistry(request);
+
+            userRegistry.createVersion(resourcePath);
+
+            Resource resource = userRegistry.get(resourcePath);
+            String permalink = resource.getPermanentPath();
+
+            responseHTML = "<a href=\"/wso2registry/web" + permalink + "\">" +
+                    getServerBaseURL(request) + "/wso2registry/web" + permalink;
+
+        } catch (RegistryException e) {
+            e.printStackTrace();
+        }
+
+        response.setContentType("text/html");
+
+        try {
+            PrintWriter writer = response.getWriter();
+            writer.println(responseHTML);
+            writer.flush();
+            writer.close();
+            
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static String getServerBaseURL(HttpServletRequest request) {
+        String reqURL = request.getRequestURL().toString();
+        return reqURL.substring(0, reqURL.indexOf("/wso2registry"));
+    }
 }

Modified: trunk/registry/modules/webapps/src/main/webapp/admin/js/common.js
==============================================================================
--- trunk/registry/modules/webapps/src/main/webapp/admin/js/common.js	(original)
+++ trunk/registry/modules/webapps/src/main/webapp/admin/js/common.js	Sat May 10 04:26:51 2008
@@ -406,6 +406,12 @@
         }
     }
 }
+
+function createVersion(resourcePath) {
+
+    new Ajax.Updater('permalinkdiv', '/wso2registry/system/createVersion', { method: 'post', parameters: {resourcePath: resourcePath} });
+}
+
 function cleanField(fld){
 fld.value="";
 fld.style.background="White";

Modified: trunk/registry/modules/webapps/src/main/webapp/admin/registry-resources.jsp
==============================================================================
--- trunk/registry/modules/webapps/src/main/webapp/admin/registry-resources.jsp	(original)
+++ trunk/registry/modules/webapps/src/main/webapp/admin/registry-resources.jsp	Sat May 10 04:26:51 2008
@@ -102,7 +102,7 @@
                                         src="/wso2registry/admin/images/icon-home-big.gif" border="0" align="top"/></a>
                             </td>
                             <td valign="top" style="padding-left:5px;"><h2 class="sub-headding-resources"><a
-                                    href="/wso2registry/web<%=rootPath.getNavigatePath()%>" title="root">/</a><%
+                                href="/wso2registry/web<%=rootPath.getNavigatePath()%>" title="root">/</a><%
 
 
 
@@ -111,7 +111,7 @@
 
 
                             %><a href="/wso2registry/web<%=childPath.getNavigatePath()%>"><%=childPath.getNavigateName()%>
-                            </a><%
+                        </a><%
 
 
                                 }
@@ -122,7 +122,7 @@
 
 
                             %>/<a href="/wso2registry/web<%=resourcePath.getNavigatePath()%>"><%=resourcePath.getNavigateName()%>
-                            </a><%
+                        </a><%
 
                             }
                            }
@@ -131,7 +131,7 @@
                             %>
 
 
-                                <span style="clear:both;"/>
+                            <span style="clear:both;"/>
                 </div>
             </td>
             <td align="right" valign="top">
@@ -193,36 +193,25 @@
         <td colspan="3"><% if (details.getMediaType() != null && details.getMediaType().length() != 0) { %><%=details.getMediaType()%><% } else { %>
             Unknown<% } %></td>
     </tr>
-    <% if (details.isCollection()) { %>
+
     <tr>
         <th valign="top">Permalink:</th>
         <td colspan="3">
+            <div id="permalinkdiv">
             <% if (details.getPermalink() == null) { %>
-                No versions are created for this resource.
-        <% } else {
-            if (!details.isVersionView()) { %>
-        <a href="/wso2registry/web<%=details.getPermalink()%>"><%=details.getServerBaseURL()%>
-            /wso2registry/web<%=details.getPermalink()%>
-        </a>
-        <% } else { %>
+            Current state of this resource is not versioned. <input type="button" value="Create version" onclick="createVersion('<%=details.getPath()%>')"/>
+            <% } else {
+                if (!details.isVersionView()) { %>
+            <a href="/wso2registry/web<%=details.getPermalink()%>"><%=details.getServerBaseURL()%>
+                /wso2registry/web<%=details.getPermalink()%>
+            </a>
+            <% } else { %>
             /wso2registry/web<%=details.getPermalink()%>
-        <% } } %>
-        </td>
-    </tr>
-    <% } else { %>
-    <tr>
-        <th>Permalink:</th>
-        <td colspan="3">
-        <% if (!details.isVersionView()) { %>
-	        <a target="_blank" href="/wso2registry/resources<%=details.getPermalink()%>">
-	        	<%=details.getServerBaseURL()%>/wso2registry/resources<%=details.getPermalink()%>
-	        </a>
-	<% } else { %>
-		<%=details.getServerBaseURL()%>/wso2registry/resources<%=details.getPermalink()%>
-	<% } %>
+            <% } } %>
+            </div>
         </td>
     </tr>
-    <% } %>
+
     <% if (!details.isVersionView()) { %>
     <tr>
         <th>Versions:</th>
@@ -340,9 +329,9 @@
                     <a onclick="showHideCommon('propViewPanel_<%=i%>');showHideCommon('propEditPanel_<%=i%>');$('propName_<%=i%>').focus();" ><img
                             title="Edit" border="0" align="top" src="/wso2registry/admin/images/icon-edit.gif"/></a>
                     <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>
+                                                                                                           border="0"
+                                                                                                           align="top"
+                                                                                                           src="/wso2registry/admin/images/icon-trash.gif"/></a>
                     <% } %>
                 </td>
             </tr>
@@ -404,7 +393,7 @@
             <td align="right" valign="middle">
 
 
-                <table cellpadding="0" cellspacing="0" border="0" class="toolBarTable" style="widht:120px;*width:80px;">
+                <table cellpadding="0" cellspacing="0" border="0" class="toolBarTable" style="width:120px;*width:80px;">
                     <tr>
                         <% if (details.isCollection() && details.isPutAllowed() && !details.isVersionView()) { %>
                         <td>
@@ -415,7 +404,7 @@
 
                         <td>
                             <a  title="Add Collection"
-                               onclick="showHide('add-folder-div');expandIfNot('entries');$('collectionName').focus();"  ><img
+                                onclick="showHide('add-folder-div');expandIfNot('entries');$('collectionName').focus();"  ><img
                                     src="/wso2registry/admin/images/icon-add-folder.gif" border="0" align="top"/></a>
                         </td>
                         <% } %>
@@ -555,124 +544,124 @@
 </div>
 <div id="entryListReason" class="validationError" style="display: none;"></div>
 <div id="entryList">
-    <table cellpadding="0" cellspacing="0" border="0" style="width:100%;" class="data-table">
-        <%
-            if (!collection.getResourceDataList().isEmpty()) {
-        %>
-        <tr>
-            <th>Name</th>
-            <th>Created Date</th>
-            <th>Author</th>
-            <th>Rating</th>
-            <th style="width:50px;">Action</th>
+<table cellpadding="0" cellspacing="0" border="0" style="width:100%;" class="data-table">
+<%
+    if (!collection.getResourceDataList().isEmpty()) {
+%>
+<tr>
+    <th>Name</th>
+    <th>Created Date</th>
+    <th>Author</th>
+    <th>Rating</th>
+    <th style="width:50px;">Action</th>
 
-        </tr>
-        <%
-            }
-            Registry  registry=CommonUtil.getUserRegistry(request);
-            int totalCount= collection.getResourceDataList().size();
-
-
-            int start;
-            int end;
-            int itemsPerPage=RegistryConstants.ITEMPS_PER_PAGE;
-            int pageNumber = 1;
-            
-            int numberOfPages=1;
-            if(totalCount%itemsPerPage==0)numberOfPages= totalCount/itemsPerPage;
-            else numberOfPages= totalCount/itemsPerPage+1;
-
-            if(totalCount<itemsPerPage){
-                start=0;
-                end=totalCount;
-            }
-            else{
-                start=(pageNumber-1)*itemsPerPage;
-                end=(pageNumber-1)*itemsPerPage + itemsPerPage;
-            }
-            Collection col=registry.get(details.getPath(),start,end) ;
-            String[] childNodes=col.getChildren();
-            CollectionPagesViewAction childCollection=null;
-
-
-            if (details.isCollection()) {
-               childCollection = new CollectionPagesViewAction();
-                childCollection.setPath(details.getPath());
-                childCollection.setChildPaths(childNodes);
-                childCollection.execute(request);
-            }
-
-              Iterator iterator = childCollection.getResourceDataList().iterator();
-            int entryNumber = 0;
-            while (iterator.hasNext()) {
-                ResourceData resourceData = (ResourceData) iterator.next();
-                entryNumber++;
-        %>
-        <tr id="1">
-            <td>
-                <% if (resourceData.getResourceType() == ResourceData.COLLECTION) { %>
-                <img src="/wso2registry/admin/images/icon-folder-small.gif" style="margin-right:5px;"/><a
-                    href="/wso2registry/web/<%=resourceData.getRelativePath()%>"
-                    id="resourceView<%=entryNumber%>"><%=resourceData.getName()%>
+</tr>
+<%
+    }
+    Registry  registry=CommonUtil.getUserRegistry(request);
+    int totalCount= collection.getResourceDataList().size();
+
+
+    int start;
+    int end;
+    int itemsPerPage=RegistryConstants.ITEMPS_PER_PAGE;
+    int pageNumber = 1;
+
+    int numberOfPages=1;
+    if(totalCount%itemsPerPage==0)numberOfPages= totalCount/itemsPerPage;
+    else numberOfPages= totalCount/itemsPerPage+1;
+
+    if(totalCount<itemsPerPage){
+        start=0;
+        end=totalCount;
+    }
+    else{
+        start=(pageNumber-1)*itemsPerPage;
+        end=(pageNumber-1)*itemsPerPage + itemsPerPage;
+    }
+    Collection col=registry.get(details.getPath(),start,end) ;
+    String[] childNodes=col.getChildren();
+    CollectionPagesViewAction childCollection=null;
+
+
+    if (details.isCollection()) {
+        childCollection = new CollectionPagesViewAction();
+        childCollection.setPath(details.getPath());
+        childCollection.setChildPaths(childNodes);
+        childCollection.execute(request);
+    }
+
+    Iterator iterator = childCollection.getResourceDataList().iterator();
+    int entryNumber = 0;
+    while (iterator.hasNext()) {
+        ResourceData resourceData = (ResourceData) iterator.next();
+        entryNumber++;
+%>
+<tr id="1">
+    <td>
+        <% if (resourceData.getResourceType() == ResourceData.COLLECTION) { %>
+        <img src="/wso2registry/admin/images/icon-folder-small.gif" style="margin-right:5px;"/><a
+            href="/wso2registry/web/<%=resourceData.getRelativePath()%>"
+            id="resourceView<%=entryNumber%>"><%=resourceData.getName()%>
+    </a>
+        <input type="text" id="resourceEdit<%=entryNumber%>" style="display:none"
+               value="<%=resourceData.getName()%>"/>
+        <% if (resourceData.isDeleteAllowed() && !details.isVersionView()) { %>|
+        <a title="Edit Collection Name"
+           onclick="showHideCommon('resourceEdit<%=entryNumber%>');showHideCommon('resourceView<%=entryNumber%>'); showHideCommon('resourceSaveButton<%=entryNumber%>');showHideCommon('resourceEditButton<%=entryNumber%>');$('resourceEdit<%=entryNumber%>').focus();"
+           id="resourceEditButton<%=entryNumber%>"><img src="/wso2registry/admin/images/icon-edit.gif"
+                                                        border="0" align="top" id="resourceEditButton"/></a>
+        <a onclick="renameResource('<%=details.getPath()%>', '<%=resourceData.getResourcePath()%>', 'resourceEdit<%=entryNumber%>',<%=pageNumber%>);showHideCommon('resourceEdit<%=entryNumber%>');showHideCommon('resourceView<%=entryNumber%>'); showHideCommon('resourceSaveButton<%=entryNumber%>');showHideCommon('resourceEditButton<%=entryNumber%>');"
+           id="resourceSaveButton<%=entryNumber%>" style="display:none;"><img border="0" align="top"
+                                                                              title="Save"
+                                                                              src="/wso2registry/admin/images/save-button.gif"/></a>
+        <% } %>
+        <% } else { %>
+        <div style="margin-left:20px;">
+            <a href="/wso2registry/web/<%=resourceData.getRelativePath()%>"
+               id="resourceView<%=entryNumber%>"><%=resourceData.getName()%>
             </a>
-                <input type="text" id="resourceEdit<%=entryNumber%>" style="display:none"
-                       value="<%=resourceData.getName()%>"/>
-                <% if (resourceData.isDeleteAllowed() && !details.isVersionView()) { %>|
-                <a title="Edit Collection Name"
-                   onclick="showHideCommon('resourceEdit<%=entryNumber%>');showHideCommon('resourceView<%=entryNumber%>'); showHideCommon('resourceSaveButton<%=entryNumber%>');showHideCommon('resourceEditButton<%=entryNumber%>');$('resourceEdit<%=entryNumber%>').focus();"
-                   id="resourceEditButton<%=entryNumber%>"><img src="/wso2registry/admin/images/icon-edit.gif"
-                                                                border="0" align="top" id="resourceEditButton"/></a>
-                <a onclick="renameResource('<%=details.getPath()%>', '<%=resourceData.getResourcePath()%>', 'resourceEdit<%=entryNumber%>',<%=pageNumber%>);showHideCommon('resourceEdit<%=entryNumber%>');showHideCommon('resourceView<%=entryNumber%>'); showHideCommon('resourceSaveButton<%=entryNumber%>');showHideCommon('resourceEditButton<%=entryNumber%>');"
-                   id="resourceSaveButton<%=entryNumber%>" style="display:none;"><img border="0" align="top"
-                                                                                      title="Save"
-                                                                                      src="/wso2registry/admin/images/save-button.gif"/></a>
-                <% } %>
-                <% } else { %>
-                <div style="margin-left:20px;">
-                    <a href="/wso2registry/web/<%=resourceData.getRelativePath()%>"
-                       id="resourceView<%=entryNumber%>"><%=resourceData.getName()%>
-                    </a>
-                    <input type="text" id="resourceEdit<%=entryNumber%>" style="display:none"
-                           value="<%=resourceData.getName()%>"/>
-                    | <a href="/wso2registry/resources<%=resourceData.getResourcePath()%>" target="_blank"
-                         title="Download"><img src="/wso2registry/admin/images/icon-download.jpg" border="0"
-                                               align="top"/></a>
-                    <% if (resourceData.isDeleteAllowed() && !details.isVersionView()) { %>| <a
-                                                                                                title="Edit Resource Name"
-                                                                                                onclick="showHideCommon('resourceEdit<%=entryNumber%>');showHideCommon('resourceView<%=entryNumber%>'); showHideCommon('resourceSaveButton<%=entryNumber%>');showHideCommon('resourceEditButton<%=entryNumber%>');$('resourceEdit<%=entryNumber%>').focus();"
-                                                                                                id="resourceEditButton<%=entryNumber%>"><img
-                        src="/wso2registry/admin/images/icon-edit.gif" border="0" align="top" id="resourceEditButton"/></a>
-                    <a onclick="renameResource('<%=details.getPath()%>', '<%=resourceData.getResourcePath()%>', 'resourceEdit<%=entryNumber%>',<%=pageNumber%>);showHideCommon('resourceEdit<%=entryNumber%>');showHideCommon('resourceView<%=entryNumber%>'); showHideCommon('resourceSaveButton<%=entryNumber%>');showHideCommon('resourceEditButton<%=entryNumber%>');"
-                       id="resourceSaveButton<%=entryNumber%>" style="display:none;"><img border="0" align="top"
-                                                                                          title="Save"
-                                                                                          src="/wso2registry/admin/images/save-button.gif"/></a>
-                    <% } %>
-                </div>
-                <% } %>
-            </td>
-            <td><%=resourceData.getFormattedCreatedOn()%>
-            </td>
-            <td><%=resourceData.getAuthorUserName()%>
-            </td>
-            <td>
-                <img src="/wso2registry/admin/images/r<%=resourceData.getAverageStars()[0]%>.gif" align="top"/>
-                <img src="/wso2registry/admin/images/r<%=resourceData.getAverageStars()[1]%>.gif" align="top"/>
-                <img src="/wso2registry/admin/images/r<%=resourceData.getAverageStars()[2]%>.gif" align="top"/>
-                <img src="/wso2registry/admin/images/r<%=resourceData.getAverageStars()[3]%>.gif" align="top"/>
-                <img src="/wso2registry/admin/images/r<%=resourceData.getAverageStars()[4]%>.gif" align="top"/>
-                (<%=resourceData.getAverageRating()%>)
-            </td>
-            <td align="left"><a href="/wso2registry/atom<%=resourceData.getResourcePath()%>" target="_blank"
-                                title="Subscribe to this feed"><img border="0"
-                                                                    src="/wso2registry/admin/images/icon-feed-small.gif"/></a>
-
-                <% if (resourceData.isDeleteAllowed() && !details.isVersionView()) { %><a
-                    href="/wso2registry/system/deleteResource?resourcePath=<%=resourceData.getResourcePath()%>"
-                    title="Delete" style="margin-left:5px;"><img src="/wso2registry/admin/images/icon-trash.gif"
-                                                                 border="0"/></a> <% } %>
-            </td>
+            <input type="text" id="resourceEdit<%=entryNumber%>" style="display:none"
+                   value="<%=resourceData.getName()%>"/>
+            | <a href="/wso2registry/resources<%=resourceData.getResourcePath()%>" target="_blank"
+                 title="Download"><img src="/wso2registry/admin/images/icon-download.jpg" border="0"
+                                       align="top"/></a>
+            <% if (resourceData.isDeleteAllowed() && !details.isVersionView()) { %>| <a
+                title="Edit Resource Name"
+                onclick="showHideCommon('resourceEdit<%=entryNumber%>');showHideCommon('resourceView<%=entryNumber%>'); showHideCommon('resourceSaveButton<%=entryNumber%>');showHideCommon('resourceEditButton<%=entryNumber%>');$('resourceEdit<%=entryNumber%>').focus();"
+                id="resourceEditButton<%=entryNumber%>"><img
+                src="/wso2registry/admin/images/icon-edit.gif" border="0" align="top" id="resourceEditButton"/></a>
+            <a onclick="renameResource('<%=details.getPath()%>', '<%=resourceData.getResourcePath()%>', 'resourceEdit<%=entryNumber%>',<%=pageNumber%>);showHideCommon('resourceEdit<%=entryNumber%>');showHideCommon('resourceView<%=entryNumber%>'); showHideCommon('resourceSaveButton<%=entryNumber%>');showHideCommon('resourceEditButton<%=entryNumber%>');"
+               id="resourceSaveButton<%=entryNumber%>" style="display:none;"><img border="0" align="top"
+                                                                                  title="Save"
+                                                                                  src="/wso2registry/admin/images/save-button.gif"/></a>
+            <% } %>
+        </div>
+        <% } %>
+    </td>
+    <td><%=resourceData.getFormattedCreatedOn()%>
+    </td>
+    <td><%=resourceData.getAuthorUserName()%>
+    </td>
+    <td>
+        <img src="/wso2registry/admin/images/r<%=resourceData.getAverageStars()[0]%>.gif" align="top"/>
+        <img src="/wso2registry/admin/images/r<%=resourceData.getAverageStars()[1]%>.gif" align="top"/>
+        <img src="/wso2registry/admin/images/r<%=resourceData.getAverageStars()[2]%>.gif" align="top"/>
+        <img src="/wso2registry/admin/images/r<%=resourceData.getAverageStars()[3]%>.gif" align="top"/>
+        <img src="/wso2registry/admin/images/r<%=resourceData.getAverageStars()[4]%>.gif" align="top"/>
+        (<%=resourceData.getAverageRating()%>)
+    </td>
+    <td align="left"><a href="/wso2registry/atom<%=resourceData.getResourcePath()%>" target="_blank"
+                        title="Subscribe to this feed"><img border="0"
+                                                            src="/wso2registry/admin/images/icon-feed-small.gif"/></a>
+
+        <% if (resourceData.isDeleteAllowed() && !details.isVersionView()) { %><a
+            href="/wso2registry/system/deleteResource?resourcePath=<%=resourceData.getResourcePath()%>"
+            title="Delete" style="margin-left:5px;"><img src="/wso2registry/admin/images/icon-trash.gif"
+                                                         border="0"/></a> <% } %>
+    </td>
 
-        </tr>
+</tr>
 
 
         <% }
@@ -714,7 +703,7 @@
                 </td></tr>
             <% } %>
 
-    </table>
+</table>
 </div>
 
 <% } else { %>
@@ -744,7 +733,7 @@
             </td>
             <td align="right" valign="middle" style="padding-top:3px;">
                 <a
-                   onclick="showHideCommon('perIconExpanded');showHideCommon('perIconMinimized');showHideCommon('perExpanded');showHideCommon('perMinimized');">
+                        onclick="showHideCommon('perIconExpanded');showHideCommon('perIconMinimized');showHideCommon('perExpanded');showHideCommon('perMinimized');">
                     <img src="/wso2registry/admin/images/icon-expanded.gif" border="0" align="top" id="perIconExpanded"
                          style="display:none;"/>
                     <img src="/wso2registry/admin/images/icon-minimized.gif" border="0" align="top"
@@ -826,18 +815,18 @@
     <% } else { %>
 
 
-        <div  id="tagAddTable" style="margin-top:5px;">
+    <div  id="tagAddTable" style="margin-top:5px;">
 
-                <input id="tfPath" type="hidden" name="resourcePath" value="<%=details.getPath()%>"/>
-                <input id="tfTag" type="text" name="tag" onkeypress="applyTag(event);"/>
+        <input id="tfPath" type="hidden" name="resourcePath" value="<%=details.getPath()%>"/>
+        <input id="tfTag" type="text" name="tag" onkeypress="applyTag(event);"/>
 
-                <div style="font-style:italic;margin-top:5px;">
+        <div style="font-style:italic;margin-top:5px;">
 
-                	<img src="/wso2registry/admin/images/help-small.jpg" style="margin-right:5px;"/>Use commas ("one, two")
-                	to add multiple tags.
+            <img src="/wso2registry/admin/images/help-small.jpg" style="margin-right:5px;"/>Use commas ("one, two")
+            to add multiple tags.
 
-        	</div>
         </div>
+    </div>
 
 
     <% } %>
@@ -985,40 +974,40 @@
             Map<String, String[]> availableActions = details.getAvailableActions();
             Iterator<String> iLifecycles = availableActions.keySet().iterator();
             if(!availableActions.isEmpty()){
-            %>
-         <h3>Available Aspects</h3>
-        <ul class="aspectList">
-        <%
-            for (int k=1;iLifecycles.hasNext();k++) {
-                String lifecycle = iLifecycles.next();
         %>
+        <h3>Available Aspects</h3>
+        <ul class="aspectList">
+            <%
+                for (int k=1;iLifecycles.hasNext();k++) {
+                    String lifecycle = iLifecycles.next();
+            %>
 
-             <li><h4><%=lifecycle%></h4>
+            <li><h4><%=lifecycle%></h4>
                 <table cellpadding="0" cellspacing="0" border="0" width="100%" class="data-table">
                     <tr><th colspan="2"><h4>Available Actions</h4></th></tr>
 
-            <%
-                String[] actions = availableActions.get(lifecycle);
-                for (String action : actions) {
-                    String actionURL = "/wso2registry" + details.getPath() +
-                            ";aspect[" + lifecycle + "]:" + action;
-            %>
-                   <tr>
-                       <td><%=action%> </td>
-                       <td>
-                           <form action="<%=actionURL%>" method="POST">
-                            <!-- input type="submit" name="<%=action%>" value="Invoke Action" -->
+                    <%
+                        String[] actions = availableActions.get(lifecycle);
+                        for (String action : actions) {
+                            String actionURL = "/wso2registry" + details.getPath() +
+                                    ";aspect[" + lifecycle + "]:" + action;
+                    %>
+                    <tr>
+                        <td><%=action%> </td>
+                        <td>
+                            <form action="<%=actionURL%>" method="POST">
+                                <!-- input type="submit" name="<%=action%>" value="Invoke Action" -->
                             </form>
-                       </td>
-                   </tr>
+                        </td>
+                    </tr>
 
-            <%
-                }
-            %>
-                   </table>
+                    <%
+                        }
+                    %>
+                </table>
             </li>
 
-        <% } }%>
+            <% } }%>
         </ul>
     </div>
 
@@ -1099,9 +1088,9 @@
                 </th>
             </tr>
             <%
-            while (deps.hasNext()) {
-                Association association = (Association) deps.next();
-        %>
+                while (deps.hasNext()) {
+                    Association association = (Association) deps.next();
+            %>
             <tr>
                 <td>
                     <%=association.getAssociationType()%>



More information about the Registry-dev mailing list