portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r553584 - in /portals/jetspeed-2/trunk: components/page-manager/src/java/org/apache/jetspeed/om/folder/psml/ components/page-manager/src/java/org/apache/jetspeed/page/document/psml/ components/page-manager/src/test/org/apache/jetspeed/page/...
Date Thu, 05 Jul 2007 18:09:46 GMT
Author: taylor
Date: Thu Jul  5 11:09:45 2007
New Revision: 553584

URL: http://svn.apache.org/viewvc?view=rev&rev=553584
Log:
https://issues.apache.org/jira/browse/JS2-745

Instead of checking for dots in path to determine if resource is a folder, we now let the
file system determine it

Added:
    portals/jetspeed-2/trunk/components/page-manager/testdata/pages/subsites/
    portals/jetspeed-2/trunk/components/page-manager/testdata/pages/subsites/apache_portals.link
    portals/jetspeed-2/trunk/components/page-manager/testdata/pages/subsites/simplefolder/
    portals/jetspeed-2/trunk/components/page-manager/testdata/pages/subsites/www.subsite1.org/
    portals/jetspeed-2/trunk/components/page-manager/testdata/pages/subsites/www.subsite2.org/
    portals/jetspeed-2/trunk/components/page-manager/testdata/pages/subsites/www.subsite3.org/
Modified:
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/psml/FolderImpl.java
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/psml/FileSystemFolderHandler.java
    portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestCastorXmlPageManager.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/page/document/FolderHandler.java

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/psml/FolderImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/psml/FolderImpl.java?view=diff&rev=553584&r1=553583&r2=553584
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/psml/FolderImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/psml/FolderImpl.java
Thu Jul  5 11:09:45 2007
@@ -37,6 +37,7 @@
 import org.apache.jetspeed.om.page.Link;
 import org.apache.jetspeed.om.page.Page;
 import org.apache.jetspeed.om.page.PageSecurity;
+import org.apache.jetspeed.page.PageManagerUtils;
 import org.apache.jetspeed.page.PageNotFoundException;
 import org.apache.jetspeed.page.document.DocumentException;
 import org.apache.jetspeed.page.document.DocumentHandlerFactory;
@@ -533,8 +534,9 @@
                         {
                             if (getPath().endsWith(PATH_SEPARATOR))
                             {
-                                if(nodeNames[i].indexOf(".") > -1)
-                                {    
+                                String full = PageManagerUtils.concatenatePaths(getPath(),
nodeNames[i]); 
+                                if (!folderHandler.isFolder(full))
+                                {
                                     node = getHandlerFactory().getDocumentHandlerForPath(nodeNames[i]).getDocument(getPath()
+ nodeNames[i]);
                                 }
                                 else
@@ -544,9 +546,10 @@
                             }
                             else
                             {
-                                
-                                if(nodeNames[i].indexOf(".") > -1)
-                                {    
+                                String full = PageManagerUtils.concatenatePaths(getPath(),
nodeNames[i]); 
+                                if (!folderHandler.isFolder(full))                      
         
+                                //if(nodeNames[i].indexOf(".") > -1)
+                                {
                                     node = getHandlerFactory().getDocumentHandlerForPath(nodeNames[i]).getDocument(getPath()
+ PATH_SEPARATOR + nodeNames[i]);
                                 }
                                 else
@@ -577,7 +580,7 @@
         
         return allNodes;
     }
-
+    
     /**
      * <p>
      * getFolderMetaData

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/psml/FileSystemFolderHandler.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/psml/FileSystemFolderHandler.java?view=diff&rev=553584&r1=553583&r2=553584
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/psml/FileSystemFolderHandler.java
(original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/psml/FileSystemFolderHandler.java
Thu Jul  5 11:09:45 2007
@@ -748,4 +748,8 @@
 
     }
 
+    public boolean isFolder(String path)
+    {
+        return new File(this.documentRootDir, path).isDirectory();        
+    }
 }

Modified: portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestCastorXmlPageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestCastorXmlPageManager.java?view=diff&rev=553584&r1=553583&r2=553584
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestCastorXmlPageManager.java
(original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestCastorXmlPageManager.java
Thu Jul  5 11:09:45 2007
@@ -487,6 +487,24 @@
         assertTrue(link.getTitle().equals("Updated Title"));
     }
 
+    public void testGetFolders() throws Exception
+    {
+
+        Folder subsites = pageManager.getFolder("/subsites");
+        assertNotNull(subsites);
+
+        Iterator ssi = subsites.getFolders().iterator();
+        assertTrue(ssi.hasNext());
+        int count = 0;
+        while (ssi.hasNext())
+        {
+            Folder folder = (Folder)ssi.next();
+            System.out.println("folder = " + folder.getName());
+            count++;
+        }
+        assertEquals(4, count);
+    }
+    
     public void testFolders() throws Exception
     {
 

Added: portals/jetspeed-2/trunk/components/page-manager/testdata/pages/subsites/apache_portals.link
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/page-manager/testdata/pages/subsites/apache_portals.link?view=auto&rev=553584
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/testdata/pages/subsites/apache_portals.link
(added)
+++ portals/jetspeed-2/trunk/components/page-manager/testdata/pages/subsites/apache_portals.link
Thu Jul  5 11:09:45 2007
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You 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.
+-->
+<link target="top" skin="test-skin"
+    xmlns="http://portals.apache.org/jetspeed"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://portals.apache.org/jetspeed http://portals.apache.org/jetspeed-2/2.1/schemas/link.xsd">
+ <title>Apache Portals Website</title>
+ <url>http://portals.apache.org</url>
+  <metadata name="title" xml:lang="fr">
+		Apache Software Foundation [french]
+ </metadata>
+</link>
\ No newline at end of file

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/page/document/FolderHandler.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/page/document/FolderHandler.java?view=diff&rev=553584&r1=553583&r2=553584
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/page/document/FolderHandler.java
(original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/page/document/FolderHandler.java
Thu Jul  5 11:09:45 2007
@@ -155,4 +155,12 @@
      */
     NodeSet getNodes(String path, boolean regexp, String documentType) throws FolderNotFoundException,
InvalidFolderException, NodeException;
     
+    /**
+     * Returns true if the path is a folder
+     * 
+     * @param path
+     * @return
+     */
+    boolean isFolder(String path);
+    
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message