portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r330134 [2/2] - in /portals/jetspeed-2/trunk: components/page-manager/src/java/JETSPEED-INF/castor/ components/page-manager/src/java/JETSPEED-INF/ojb/ components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/ components/page-mana...
Date Tue, 01 Nov 2005 22:13:39 GMT
Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java?rev=330134&r1=330133&r2=330134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java Tue Nov  1 14:13:18 2005
@@ -1,8 +1,25 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * 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.
+ */
 package org.apache.jetspeed.page.impl;
 
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.Map;
 
+import org.apache.commons.collections.map.LRUMap;
 import org.apache.jetspeed.components.dao.InitablePersistenceBrokerDaoSupport;
 import org.apache.jetspeed.exception.JetspeedException;
 import org.apache.jetspeed.om.common.SecurityConstraint;
@@ -21,7 +38,6 @@
 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.om.page.Property;
 import org.apache.jetspeed.om.page.impl.FragmentImpl;
 import org.apache.jetspeed.om.page.impl.PageImpl;
 import org.apache.jetspeed.page.DelegatingPageManager;
@@ -37,6 +53,7 @@
 import org.apache.jetspeed.page.document.DocumentNotFoundException;
 import org.apache.jetspeed.page.document.NodeException;
 import org.apache.jetspeed.page.document.UnsupportedDocumentTypeException;
+import org.apache.jetspeed.page.document.impl.NodeAttributes;
 import org.apache.ojb.broker.query.Criteria;
 import org.apache.ojb.broker.query.QueryByCriteria;
 import org.apache.ojb.broker.query.QueryFactory;
@@ -45,11 +62,11 @@
  * DatabasePageManager
  * 
  * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
  * @version $Id: $
  */
 
-public class DatabasePageManager extends InitablePersistenceBrokerDaoSupport
-        implements PageManager
+public class DatabasePageManager extends InitablePersistenceBrokerDaoSupport implements PageManager
 {
     private static Map modelClasses = new HashMap();
     static
@@ -58,7 +75,6 @@
         modelClasses.put("PageImpl.class", PageImpl.class);
         modelClasses.put("FolderImpl.class", FolderImpl.class);
         //modelClasses.put("LinkImpl.class", LinkImpl.class);
-        //modelClasses.put("PropertyImpl.class", PropertyImpl.class);
         //modelClasses.put("MenuDefinitionImpl.class", MenuDefinitionImpl.class);
         //modelClasses.put("MenuExcludeDefinitionImpl.class", MenuExcludeDefinitionImpl.class);
         //modelClasses.put("MenuIncludeDefinitionImpl.class", MenuIncludeDefinitionImpl.class);
@@ -70,15 +86,13 @@
 
     private DelegatingPageManager delegator;
     
-    public DatabasePageManager(
-            String repositoryPath,
-            boolean isPermissionsSecurity, 
-            boolean isConstraintsSecurity)
+    private LRUMap databaseNodeCache;
 
+    public DatabasePageManager(String repositoryPath, int cacheSize, boolean isPermissionsSecurity, boolean isConstraintsSecurity)
     {
         super(repositoryPath);
-        System.out.println("Page Manager repo = " + repositoryPath);
         delegator = new DelegatingPageManager(isPermissionsSecurity, isConstraintsSecurity, modelClasses);
+        databaseNodeCache = new LRUMap(cacheSize);
     }
 
     /* (non-Javadoc)
@@ -135,14 +149,6 @@
     }
     
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.page.PageManager#newProperty()
-     */
-    public Property newProperty()
-    {
-        return delegator.newProperty();
-    }
-
-    /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#newMenuDefinition()
      */
     public MenuDefinition newMenuDefinition()
@@ -203,22 +209,49 @@
      */
     public Page getPage(String path) throws PageNotFoundException, NodeException
     {
-        Criteria filter = new Criteria();
-        filter.addEqualTo("path", path);
-        QueryByCriteria query = QueryFactory.newQuery(PageImpl.class, filter);
-        Page page = (Page) getPersistenceBrokerTemplate().getObjectByQuery(query);
-        if (page == null)
+        // construct page attributes from path
+        NodeAttributes attributes = new NodeAttributes(path);
+        path = attributes.getCanonicalPath();
+
+        // test cache with canonical path if available
+        if (databaseNodeCache.containsKey(path))
         {
-            throw new PageNotFoundException("Page " + path + " not found.");
+            // return cached page or throw exception if cached as null
+            Page page = (Page) databaseNodeCache.get(path);
+            if (page == null)
+            {
+                throw new PageNotFoundException("Page " + path + " not found.");
+            }
+            return page;
+        }
+        
+        // retrieve page from database
+        try
+        {
+            Criteria filter = attributes.newQueryCriteria();
+            QueryByCriteria query = QueryFactory.newQuery(PageImpl.class, filter);
+            Page page = (Page) getPersistenceBrokerTemplate().getObjectByQuery(query);
+            
+            // add to or delete entry in document cache
+            databaseNodeCache.put(path, page);
+            
+            // return page or throw exception
+            if (page == null)
+            {
+                throw new PageNotFoundException("Page " + path + " not found.");
+            }
+            return page;
+        }
+        catch (Exception e)
+        {
+            throw new PageNotFoundException("Page " + path + " not found.", e);
         }
-        return page;
     }
 
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#getContentPage(java.lang.String)
      */
-    public ContentPage getContentPage(String path)
-            throws PageNotFoundException, NodeException
+    public ContentPage getContentPage(String path) throws PageNotFoundException, NodeException
     {
         // TODO Auto-generated method stub
         return null;
@@ -227,9 +260,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#getLink(java.lang.String)
      */
-    public Link getLink(String name) throws DocumentNotFoundException,
-            UnsupportedDocumentTypeException, FolderNotFoundException,
-            NodeException
+    public Link getLink(String name) throws DocumentNotFoundException, UnsupportedDocumentTypeException, FolderNotFoundException, NodeException
     {
         // TODO Auto-generated method stub
         return null;
@@ -238,9 +269,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#getPageSecurity()
      */
-    public PageSecurity getPageSecurity() throws DocumentNotFoundException,
-            UnsupportedDocumentTypeException, FolderNotFoundException,
-            NodeException
+    public PageSecurity getPageSecurity() throws DocumentNotFoundException, UnsupportedDocumentTypeException, FolderNotFoundException, NodeException
     {
         // TODO Auto-generated method stub
         return null;
@@ -249,163 +278,220 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#getFolder(java.lang.String)
      */
-    public Folder getFolder(String folderPath) throws FolderNotFoundException,
-            InvalidFolderException, NodeException
+    public Folder getFolder(String folderPath) throws FolderNotFoundException, InvalidFolderException, NodeException
     {
-        Criteria filter = new Criteria();
-        filter.addEqualTo("path", folderPath);
-        QueryByCriteria query = QueryFactory.newQuery(FolderImpl.class, filter);
-        Folder folder = (Folder) getPersistenceBrokerTemplate().getObjectByQuery(query);
-        if (folder == null)
+        // construct folder attributes from path
+        NodeAttributes attributes = new NodeAttributes(folderPath);
+        folderPath = attributes.getCanonicalPath();
+
+        // test cache with canonical path if available
+        if (databaseNodeCache.containsKey(folderPath))
+        {
+            // return cached folder or throw exception if cached as null
+            Folder folder = (Folder) databaseNodeCache.get(folderPath);
+            if (folder == null)
+            {
+                throw new FolderNotFoundException("Folder " + folderPath + " not found.");
+            }
+            return folder;
+        }
+
+        // retrieve folder from database
+        try
+        {
+            Criteria filter = attributes.newQueryCriteria();
+            QueryByCriteria query = QueryFactory.newQuery(FolderImpl.class, filter);
+            Folder folder = (Folder) getPersistenceBrokerTemplate().getObjectByQuery(query);
+            
+            // add to or delete entry in folder cache
+            databaseNodeCache.put(folderPath, folder);
+            
+            // return folder or throw exception
+            if (folder == null)
+            {
+                throw new FolderNotFoundException("Folder " + folderPath + " not found.");
+            }
+            return folder;
+        }
+        catch (Exception e)
         {
-            throw new FolderNotFoundException("Folder " + folderPath + " not found.");
+            throw new FolderNotFoundException("Folder " + folderPath + " not found.", e);
         }
-        return folder;
     }
 
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#updatePage(org.apache.jetspeed.om.page.Page)
      */
-    public void updatePage(Page page) throws JetspeedException,
-            PageNotUpdatedException
+    public void updatePage(Page page) throws JetspeedException, PageNotUpdatedException
     {
-        System.out.println("storing page " + page.getPath());
-
-        // look up and set parent folder if necessary
-        if (page.getParent() == null)
+        try
         {
-            // access folder by path
-            String pagePath = page.getPath();
-            String parentPath = pagePath.substring(0, pagePath.lastIndexOf(Folder.PATH_SEPARATOR));
-            if (parentPath.length() == 0)
-            {
-                parentPath = Folder.PATH_SEPARATOR;
-            }
-            FolderImpl parent = null;
-            try
+            // look up and set parent folder if necessary
+            if (page.getParent() == null)
             {
-                parent = (FolderImpl)getFolder(parentPath);
+                // access folder by path
+                String pagePath = page.getPath();
+                String parentPath = pagePath.substring(0, pagePath.lastIndexOf(Folder.PATH_SEPARATOR));
+                if (parentPath.length() == 0)
+                {
+                    parentPath = Folder.PATH_SEPARATOR;
+                }
+                FolderImpl parent = null;
+                try
+                {
+                    parent = (FolderImpl)getFolder(parentPath);
+                }
+                catch (FolderNotFoundException fnfe)
+                {
+                    throw new PageNotUpdatedException("Missing parent folder: " + parentPath);
+                }
+                
+                // update parent folder with added page
+                parent.addPage((PageImpl)page);
+                page.setParent(parent);
+                getPersistenceBrokerTemplate().store(parent);
+                
+                // update document cache
+                databaseNodeCache.put(pagePath, page);
             }
-            catch (FolderNotFoundException fnfe)
+            else
             {
-                throw new PageNotUpdatedException("Missing parent folder: " + parentPath);
+                // update page
+                getPersistenceBrokerTemplate().store(page);
+                
+                // update document cache
+                databaseNodeCache.put(page.getPath(), page);
             }
-
-            // update page and parent folder
-            parent.addPage((PageImpl)page);
-            page.setParent(parent);
-            getPersistenceBrokerTemplate().store(parent);
-            getPersistenceBrokerTemplate().store(page);
         }
-        else
+        catch (Exception e)
         {
-            // update page
-            getPersistenceBrokerTemplate().store(page);
+            throw new PageNotUpdatedException("Page " + page.getPath() + " not updated.", e);
         }
-
-        System.out.println("**** stored page " + page.getPath());        
     }
 
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#removePage(org.apache.jetspeed.om.page.Page)
      */
-    public void removePage(Page page) throws JetspeedException,
-            PageNotRemovedException
+    public void removePage(Page page) throws JetspeedException, PageNotRemovedException
     {
-        System.out.println("deleting page " + page.getPath());
-
-        // look up and update parent folder if necessary
-        if (page.getParent() != null)
+        try
         {
-            // delete page and update parent folder
-            FolderImpl parent = (FolderImpl)page.getParent();
-            parent.removePage((PageImpl)page);
-            getPersistenceBrokerTemplate().store(parent);
-            getPersistenceBrokerTemplate().delete(page);
+            // look up and update parent folder if necessary
+            if (page.getParent() != null)
+            {
+                // update parent folder with removed page; deletes page
+                FolderImpl parent = (FolderImpl)page.getParent();
+                parent.removePage((PageImpl)page);
+                getPersistenceBrokerTemplate().store(parent);
+            }
+            else
+            {
+                // delete page
+                getPersistenceBrokerTemplate().delete(page);
+            }
+            
+            // delete document cache entry
+            databaseNodeCache.put(page.getPath(), null);
         }
-        else
+        catch (Exception e)
         {
-            // delete page
-            getPersistenceBrokerTemplate().delete(page);
+            throw new PageNotRemovedException("Page " + page.getPath() + " not removed.", e);
         }
-
-        System.out.println("**** deleted page " + page.getPath());        
     }
 
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#updateFolder(org.apache.jetspeed.om.folder.Folder)
      */
-    public void updateFolder(Folder folder) throws JetspeedException,
-            FolderNotUpdatedException
+    public void updateFolder(Folder folder) throws JetspeedException, FolderNotUpdatedException
     {
-        System.out.println("storing folder " + folder.getPath());
-
-        // look up and set parent folder if necessary
-        if ((folder.getParent() == null) && !folder.getPath().equals(Folder.PATH_SEPARATOR))
+        try
         {
-            // access folder by path
-            String folderPath = folder.getPath();
-            String parentPath = folderPath.substring(0, folderPath.lastIndexOf(Folder.PATH_SEPARATOR));
-            if (parentPath.length() == 0)
+            // look up and set parent folder if necessary
+            if ((folder.getParent() == null) && !folder.isRootFolder())
             {
-                parentPath = Folder.PATH_SEPARATOR;
+                // access folder by path
+                String folderPath = folder.getPath();
+                String parentPath = folderPath.substring(0, folderPath.lastIndexOf(Folder.PATH_SEPARATOR));
+                if (parentPath.length() == 0)
+                {
+                    parentPath = Folder.PATH_SEPARATOR;
+                }
+                FolderImpl parent = null;
+                try
+                {
+                    parent = (FolderImpl)getFolder(parentPath);
+                }
+                catch (FolderNotFoundException fnfe)
+                {
+                    throw new FolderNotUpdatedException("Missing parent folder: " + parentPath);
+                }
+                
+                // update parent folder with added folder
+                parent.addFolder((FolderImpl)folder);
+                folder.setParent(parent);
+                getPersistenceBrokerTemplate().store(parent);
+                
+                // update folder cache
+                databaseNodeCache.put(folderPath, folder);
             }
-            FolderImpl parent = null;
-            try
+            else
             {
-                parent = (FolderImpl)getFolder(parentPath);
+                // update folder
+                getPersistenceBrokerTemplate().store(folder);
+                
+                // update folder cache
+                databaseNodeCache.put(folder.getPath(), folder);
             }
-            catch (FolderNotFoundException fnfe)
-            {
-                throw new FolderNotUpdatedException("Missing parent folder: " + parentPath);
-            }
-
-            // update folder and parent folder
-            parent.addFolder((FolderImpl)folder);
-            folder.setParent(parent);
-            getPersistenceBrokerTemplate().store(parent);
-            getPersistenceBrokerTemplate().store(folder);
         }
-        else
+        catch (Exception e)
         {
-            // update folder
-            getPersistenceBrokerTemplate().store(folder);
+            throw new FolderNotUpdatedException("Folder " + folder.getPath() + " not updated.", e);
         }
-
-        System.out.println("**** stored folder " + folder.getPath());        
     }
 
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#removeFolder(org.apache.jetspeed.om.folder.Folder)
      */
-    public void removeFolder(Folder folder) throws JetspeedException,
-            FolderNotRemovedException
+    public void removeFolder(Folder folder) throws JetspeedException, FolderNotRemovedException
     {
-        System.out.println("deleting folder " + folder.getPath());
-
-        // look up and update parent folder if necessary
-        if (folder.getParent() != null)
+        try
         {
-            // delete folder and update parent folder
-            FolderImpl parent = (FolderImpl)folder.getParent();
-            parent.removeFolder((FolderImpl)folder);
-            getPersistenceBrokerTemplate().store(parent);
-            getPersistenceBrokerTemplate().delete(folder);
+            // look up and update parent folder if necessary
+            if (folder.getParent() != null)
+            {
+                // update parent folder with removed folder; deep deletes folder
+                FolderImpl parent = (FolderImpl)folder.getParent();
+                parent.removeFolder((FolderImpl)folder);
+                getPersistenceBrokerTemplate().store(parent);
+            }
+            else
+            {
+                // deep delete folder
+                getPersistenceBrokerTemplate().delete(folder);
+            }
+            
+            // delete folder and document cache entries
+            String folderPath = folder.getPath();
+            Iterator cacheIter = databaseNodeCache.entrySet().iterator();
+            while (cacheIter.hasNext())
+            {
+                Map.Entry cacheEntry = (Map.Entry)cacheIter.next();
+                if (((String)cacheEntry.getKey()).startsWith(folderPath))
+                {
+                    cacheEntry.setValue(null);
+                }
+            }
         }
-        else
+        catch (Exception e)
         {
-            // delete folder
-            getPersistenceBrokerTemplate().delete(folder);
+            throw new FolderNotRemovedException("Folder " + folder.getPath() + " not removed.", e);
         }
-
-        System.out.println("**** deleted folder " + folder.getPath());        
     }
 
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#updateLink(org.apache.jetspeed.om.page.Link)
      */
-    public void updateLink(Link link) throws JetspeedException,
-            LinkNotUpdatedException
+    public void updateLink(Link link) throws JetspeedException, LinkNotUpdatedException
     {
         // TODO Auto-generated method stub
 
@@ -414,8 +500,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#removeLink(org.apache.jetspeed.om.page.Link)
      */
-    public void removeLink(Link link) throws JetspeedException,
-            LinkNotRemovedException
+    public void removeLink(Link link) throws JetspeedException, LinkNotRemovedException
     {
         // TODO Auto-generated method stub
 
@@ -442,8 +527,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#clonePage(org.apache.jetspeed.om.page.Page, java.lang.String)
      */
-    public Page clonePage(Page source, String path) throws JetspeedException,
-            PageNotUpdatedException
+    public Page clonePage(Page source, String path) throws JetspeedException, PageNotUpdatedException
     {
         // TODO Auto-generated method stub
         return null;

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/psml/CastorXmlPageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/psml/CastorXmlPageManager.java?rev=330134&r1=330133&r2=330134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/psml/CastorXmlPageManager.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/psml/CastorXmlPageManager.java Tue Nov  1 14:13:18 2005
@@ -47,7 +47,6 @@
 import org.apache.jetspeed.om.page.psml.FragmentImpl;
 import org.apache.jetspeed.om.page.psml.LinkImpl;
 import org.apache.jetspeed.om.page.psml.PageImpl;
-import org.apache.jetspeed.om.page.psml.PropertyImpl;
 import org.apache.jetspeed.om.page.psml.SecurityConstraintImpl;
 import org.apache.jetspeed.om.page.psml.SecurityConstraintsImpl;
 import org.apache.jetspeed.page.AbstractPageManager;
@@ -73,9 +72,6 @@
 {
     private final static Log log = LogFactory.getLog(CastorXmlPageManager.class);
 
-    protected final static String PROFILE_PROPERTY_FOLDER_PREFIX = "_";
-    protected final static String PROFILE_NAVIGATION_PROPERTY_FOLDER_PREFIX = "__";
-
     private static Map modelClasses = new HashMap();
     static
     {
@@ -83,7 +79,6 @@
         modelClasses.put("PageImpl.class", PageImpl.class);
         modelClasses.put("FolderImpl.class", FolderImpl.class);
         modelClasses.put("LinkImpl.class", LinkImpl.class);
-        modelClasses.put("PropertyImpl.class", PropertyImpl.class);
         modelClasses.put("MenuDefinitionImpl.class", MenuDefinitionImpl.class);
         modelClasses.put("MenuExcludeDefinitionImpl.class", MenuExcludeDefinitionImpl.class);
         modelClasses.put("MenuIncludeDefinitionImpl.class", MenuIncludeDefinitionImpl.class);

Modified: portals/jetspeed-2/trunk/components/page-manager/src/test/database-page-manager.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/test/database-page-manager.xml?rev=330134&r1=330133&r2=330134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/test/database-page-manager.xml (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/test/database-page-manager.xml Tue Nov  1 14:13:18 2005
@@ -17,18 +17,18 @@
 -->
 <beans>
 
-  <bean 
-       id="org.apache.jetspeed.page.PageManagerImpl" 
-       name="pageManagerImpl"
-       init-method="init"
-       class="org.apache.jetspeed.page.impl.DatabasePageManager">         
-        <constructor-arg index="0">
-            <value>JETSPEED-INF/ojb/page-manager-repository.xml</value>
-        </constructor-arg>       
-       <!-- permissions security enabled flag, default=false -->
-       <constructor-arg index="1"><value>false</value></constructor-arg>
-       <!-- constraints security enabled flag, default=true -->
-       <constructor-arg index="2"><value>false</value></constructor-arg>
+  <bean id="org.apache.jetspeed.page.PageManagerImpl" 
+        name="pageManagerImpl"
+        init-method="init"
+        class="org.apache.jetspeed.page.impl.DatabasePageManager">
+      <!-- OJB configuration file resource path -->
+      <constructor-arg index="0"><value>JETSPEED-INF/ojb/page-manager-repository.xml</value></constructor-arg>       
+      <!-- folder/page/link cache size, default=128 -->
+      <constructor-arg index="1"><value>128</value></constructor-arg>
+      <!-- permissions security enabled flag, default=false -->
+      <constructor-arg index="2"><value>false</value></constructor-arg>
+      <!-- constraints security enabled flag, default=true -->
+      <constructor-arg index="3"><value>false</value></constructor-arg>
   </bean>
 
     <!-- Proxying -->

Modified: portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestCastorXmlPageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestCastorXmlPageManager.java?rev=330134&r1=330133&r2=330134&view=diff
==============================================================================
--- 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 Tue Nov  1 14:13:18 2005
@@ -23,6 +23,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
+import java.util.Map;
 
 import junit.framework.Test;
 import junit.framework.TestCase;
@@ -47,7 +48,6 @@
 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.om.page.Property;
 import org.apache.jetspeed.page.document.DocumentHandler;
 import org.apache.jetspeed.page.document.DocumentHandlerFactory;
 import org.apache.jetspeed.page.document.DocumentNotFoundException;
@@ -182,11 +182,6 @@
         assertTrue(f.getType().equals(Fragment.LAYOUT));
     }
 
-    public void testNewProperty()
-    {
-        // TODO: Fix Property manipulation API, too clumsy right now
-    }
-
     public void testNewFolder()
     {
         Folder testfolder = pageManager.newFolder(this.testFolder3);
@@ -237,26 +232,22 @@
         assertTrue(f.getName().equals("HelloPortlet"));
         assertTrue(f.getType().equals(Fragment.PORTLET));
 
-        List properties = f.getProperties(root.getName());
+        Map properties = f.getProperties();
         assertNotNull(properties);
         assertTrue(properties.size() == 2);
-        assertTrue(((Property) properties.get(0)).getName().equals("row"));
-        assertTrue(((Property) properties.get(0)).getValue().equals("0"));
-        assertTrue(((Property) properties.get(1)).getName().equals("column"));
-        assertTrue(((Property) properties.get(1)).getValue().equals("0"));
+        assertEquals("0", f.getProperty(Fragment.ROW_PROPERTY_NAME));
+        assertEquals(0, f.getIntProperty(Fragment.COLUMN_PROPERTY_NAME));
 
         f = (Fragment) children.get(1);
         assertTrue(f.getId().equals("pe002"));
         assertTrue(f.getName().equals("JMXPortlet"));
         assertTrue(f.getType().equals(Fragment.PORTLET));
 
-        properties = f.getProperties(root.getName());
+        properties = f.getProperties();
         assertNotNull(properties);
         assertTrue(properties.size() == 2);
-        assertTrue(((Property) properties.get(0)).getName().equals("row"));
-        assertTrue(((Property) properties.get(0)).getValue().equals("0"));
-        assertTrue(((Property) properties.get(1)).getName().equals("column"));
-        assertTrue(((Property) properties.get(1)).getValue().equals("1"));
+        assertEquals("0", f.getProperty(Fragment.ROW_PROPERTY_NAME));
+        assertEquals(1, f.getIntProperty(Fragment.COLUMN_PROPERTY_NAME));
 
         f = testpage.getFragmentById("f002");
         assertNotNull(f);
@@ -283,16 +274,9 @@
         Fragment f = pageManager.newFragment();
         f.setType(Fragment.PORTLET);
         f.setName("TestPortlet");
-        Property p = pageManager.newProperty();
-        p.setLayout("TestLayout");
-        p.setName("row");
-        p.setValue("0");
-        f.addProperty(p);
-        p = pageManager.newProperty();
-        p.setLayout("TestLayout");
-        p.setName("column");
-        p.setValue("0");
-        f.addProperty(p);
+        Map properties = f.getProperties();
+        properties.put(Fragment.ROW_PROPERTY_NAME, "0");
+        properties.put(Fragment.COLUMN_PROPERTY_NAME, "0");
         root.getFragments().add(f);
 
         SecurityConstraints constraints = pageManager.newSecurityConstraints();
@@ -332,8 +316,8 @@
         assertTrue(page.getRootFragment().getFragments().size() == 1);
 
         f = (Fragment) page.getRootFragment().getFragments().get(0);
-        assertNotNull(f.getProperties("TestLayout"));
-        assertTrue(((Property) f.getProperties("TestLayout").get(0)).getValue().equals("0"));
+        assertNotNull(f.getProperties());
+        assertEquals(0, f.getIntProperty(Fragment.ROW_PROPERTY_NAME));
     }
 
     public void testCreateFolder() throws Exception
@@ -896,15 +880,13 @@
         assertTrue(cf.getName().equals("HelloPortlet"));
         assertTrue(cf.getType().equals(Fragment.PORTLET));
 
-        List properties = f.getProperties(root.getName());
-        List cloneProperties = cf.getProperties(cloneRoot.getName());
-        
+        Map properties = f.getProperties();
+        Map cloneProperties = cf.getProperties();
+
         assertNotNull(cloneProperties);
         assertTrue(cloneProperties.size() == 2);
-        assertTrue(((Property) cloneProperties.get(0)).getName().equals("row"));
-        assertTrue(((Property) cloneProperties.get(0)).getValue().equals("0"));
-        assertTrue(((Property) cloneProperties.get(1)).getName().equals("column"));
-        assertTrue(((Property) cloneProperties.get(1)).getValue().equals("0"));
+        assertEquals("0", cf.getProperty(Fragment.ROW_PROPERTY_NAME));
+        assertEquals(0, cf.getIntProperty(Fragment.COLUMN_PROPERTY_NAME));
 
         cf = (Fragment) cloneChildren.get(1);
         f = (Fragment) children.get(1);
@@ -913,13 +895,11 @@
         assertTrue(cf.getName().equals("JMXPortlet"));
         assertTrue(cf.getType().equals(Fragment.PORTLET));
 
-        properties = cf.getProperties(root.getName());        
+        properties = cf.getProperties();
         assertNotNull(properties);
         assertTrue(properties.size() == 2);
-        assertTrue(((Property) properties.get(0)).getName().equals("row"));
-        assertTrue(((Property) properties.get(0)).getValue().equals("0"));
-        assertTrue(((Property) properties.get(1)).getName().equals("column"));
-        assertTrue(((Property) properties.get(1)).getValue().equals("1"));
+        assertEquals("0", cf.getProperty(Fragment.ROW_PROPERTY_NAME));
+        assertEquals(1, cf.getIntProperty(Fragment.COLUMN_PROPERTY_NAME));
 
         f = testpage.getFragmentById("f002");
         cf = (Fragment) cloneChildren.get(2);

Modified: portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestDatabasePageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestDatabasePageManager.java?rev=330134&r1=330133&r2=330134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestDatabasePageManager.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestDatabasePageManager.java Tue Nov  1 14:13:18 2005
@@ -112,6 +112,7 @@
     {
         try
         {
+            // test basic folder/page/fragment creation
             Folder folder = pageManager.newFolder("/");
             folder.setTitle("Root Folder");
             folder.setDefaultPage("default-page.psml");
@@ -127,7 +128,7 @@
             page.setDefaultDecorator("blue-gradient", Fragment.PORTLET);
             page.setDefaultSkin("skin-1");
             page.setShortTitle("Default");
-            
+
             Fragment root = page.getRootFragment();
             root.setDecorator("blue-gradient");
             root.setName("jetspeed-layouts::VelocityTwoColumns");
@@ -135,6 +136,8 @@
             root.setTitle("Root Fragment");
             root.setState("Normal");
             root.setLayoutSizes("50%,50%");
+            root.getProperties().put("custom-prop1", "custom-prop-value1");
+            root.getProperties().put("custom-prop2", "custom-prop-value2");
             
             Fragment portlet = pageManager.newPortletFragment();
             portlet.setName("security::LoginPortlet");
@@ -144,34 +147,90 @@
             portlet.setLayoutRow(88);
             portlet.setLayoutColumn(99);
             root.getFragments().add(portlet);
-            
+
             pageManager.updatePage(page);
 
             assertNotNull(page.getParent());
             assertEquals(page.getParent().getId(), folder.getId());
-            
+
             try
             {
                 Page check = pageManager.getPage("/default-page.psml");
+                assertEquals("/default-page.psml", check.getPath());
             }
             catch (PageNotFoundException e)
             {
-                assertTrue("Page /default-page.psml NOT FOUND", true);
+                assertTrue("Page /default-page.psml NOT FOUND", false);
             }
             try
             {
                 Folder checkFolder = pageManager.getFolder("/");
+                assertEquals("/", checkFolder.getPath());
             }
             catch (FolderNotFoundException e)
             {
-                assertTrue("Folder / NOT FOUND", true);
+                assertTrue("Folder / NOT FOUND", false);
             }
-            
+            try
+            {
+                Folder checkFolder = pageManager.newFolder("/");
+                pageManager.updateFolder(checkFolder);
+                assertTrue("Duplicate Folder / CREATED", false);
+            }
+            catch (FolderNotUpdatedException e)
+            {
+                assertTrue("Duplicate Folder / NOT CREATED", true);
+            }
+
+            pageManager.removeFolder(folder);
+
+            // test folder/page creation with attributes
+            String testAttributesPath = "/__custom/subsiteX/_user/userX/_role/roleX/_group/groupX/_mediatype/xhtml/_language/en/_country/us/_custom/customX";
+            String verifyTestAttributesPath = "/__subsite-root/subsitex/_user/userx/_role/rolex/_group/groupx/_mediatype/xhtml/_language/en/_country/us/_custom/customx";
+            folder = pageManager.newFolder(testAttributesPath);
+            pageManager.updateFolder(folder);
+            assertNull(folder.getParent());
+
+            page = pageManager.newPage(testAttributesPath + "/default-page.psml");
+            pageManager.updatePage(page);
+
+            assertNotNull(page.getParent());
+            assertEquals(page.getParent().getId(), folder.getId());
+
+            try
+            {
+                Page check = pageManager.getPage(testAttributesPath + "/default-page.psml");
+                assertEquals(verifyTestAttributesPath + "/default-page.psml", check.getPath());
+            }
+            catch (PageNotFoundException e)
+            {
+                assertTrue("Page " + testAttributesPath + "/default-page.psml NOT FOUND", false);
+            }
+            try
+            {
+                Folder checkFolder = pageManager.getFolder(testAttributesPath);
+                assertEquals(verifyTestAttributesPath, checkFolder.getPath());
+            }
+            catch (FolderNotFoundException e)
+            {
+                assertTrue("Folder " + testAttributesPath + " NOT FOUND", false);
+            }
+            try
+            {
+                Folder checkFolder = pageManager.newFolder(testAttributesPath);
+                pageManager.updateFolder(checkFolder);
+                assertTrue("Duplicate Folder " + testAttributesPath + " CREATED", false);
+            }
+            catch (FolderNotUpdatedException e)
+            {
+                assertTrue("Duplicate Folder " + testAttributesPath + " NOT CREATED", true);
+            }
+
             pageManager.removeFolder(folder);
-            
         }
         catch (Exception e)
         {
+            e.printStackTrace(System.out);
             fail("could not create test data: "+e);
         }
     }

Modified: portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/om/folder/proxy/FolderProxy.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/om/folder/proxy/FolderProxy.java?rev=330134&r1=330133&r2=330134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/om/folder/proxy/FolderProxy.java (original)
+++ portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/om/folder/proxy/FolderProxy.java Tue Nov  1 14:13:18 2005
@@ -762,8 +762,8 @@
                     // accessed only via SiteView search path
                     // aggregation that directly utilizes the
                     // current view page manager
-                    if (!(child instanceof Folder) || (!childName.startsWith(SiteView.PROFILING_NAVIGATION_PROPERTY_FOLDER_PREFIX) &&
-                                                       !childName.startsWith(SiteView.PROFILING_PROPERTY_FOLDER_PREFIX)))
+                    if (!(child instanceof Folder) || (!childName.startsWith(Folder.RESERVED_SUBSITE_FOLDER_PREFIX) &&
+                                                       !childName.startsWith(Folder.RESERVED_FOLDER_PREFIX)))
                     {
                         // test child name uniqueness
                         boolean childUnique = true ;

Modified: portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteView.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteView.java?rev=330134&r1=330133&r2=330134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteView.java (original)
+++ portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteView.java Tue Nov  1 14:13:18 2005
@@ -50,16 +50,6 @@
 public class SiteView
 {
     /**
-     * PROFILING_PROPERTY_FOLDER_PREFIX - folder name prefix for profiling folders
-     */
-    public final static String PROFILING_PROPERTY_FOLDER_PREFIX = "_";
-
-    /**
-     * PROFILING_NAVIGATION_PROPERTY_FOLDER_PREFIX - folder name prefix for profiling navigating folders
-     */
-    public final static String PROFILING_NAVIGATION_PROPERTY_FOLDER_PREFIX = "__";
-
-    /**
      * CURRENT_PAGE_PATH - expression used to match the current page
      */
     public final static String CURRENT_PAGE_PATH = "~";
@@ -404,9 +394,9 @@
                             int folderIndex = 1;
                             do
                             {
-                                if (!pathRoot.regionMatches(folderIndex, PROFILING_NAVIGATION_PROPERTY_FOLDER_PREFIX, 0, PROFILING_NAVIGATION_PROPERTY_FOLDER_PREFIX.length()))
+                                if (!pathRoot.regionMatches(folderIndex, Folder.RESERVED_SUBSITE_FOLDER_PREFIX, 0, Folder.RESERVED_SUBSITE_FOLDER_PREFIX.length()))
                                 {
-                                    pathRoot = pathRoot.substring(0, folderIndex) + PROFILING_NAVIGATION_PROPERTY_FOLDER_PREFIX + pathRoot.substring(folderIndex);
+                                    pathRoot = pathRoot.substring(0, folderIndex) + Folder.RESERVED_SUBSITE_FOLDER_PREFIX + pathRoot.substring(folderIndex);
                                 }
                                 folderIndex = pathRoot.indexOf(Folder.PATH_SEPARATOR, folderIndex) + 1;
                             }
@@ -475,7 +465,7 @@
                             while (pathsIter.hasNext())
                             {
                                 StringBuffer path = (StringBuffer) pathsIter.next();
-                                path.append(PROFILING_PROPERTY_FOLDER_PREFIX);
+                                path.append(Folder.RESERVED_FOLDER_PREFIX);
                                 path.append(propertyName);
                                 path.append(Folder.PATH_SEPARATOR_CHAR);
                                 path.append(propertyValue);

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorFragmentImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorFragmentImpl.java?rev=330134&r1=330133&r2=330134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorFragmentImpl.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorFragmentImpl.java Tue Nov  1 14:13:18 2005
@@ -16,11 +16,12 @@
 package org.apache.jetspeed.aggregator.impl;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.jetspeed.om.common.SecurityConstraints;
 import org.apache.jetspeed.om.page.Fragment;
-import org.apache.jetspeed.om.page.Property;
 
 /**
  * PortletAggregator Fragment implementation for rendering.
@@ -219,55 +220,27 @@
     }
     
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.page.Fragment#getLayoutProperties()
+     * @see org.apache.jetspeed.om.page.Fragment#getProperties()
      */
-    public List getLayoutProperties()
+    public Map getProperties()
     {
-        return new ArrayList(0);
+        return new HashMap(0);
     }
     
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.page.Fragment#getProperties(java.lang.String)
+     * @see org.apache.jetspeed.om.page.Fragment#getProperty(java.lang.String)
      */
-    public List getProperties(String layoutName)
-    {
-        return new ArrayList(0);
-    }
-    
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.page.Fragment#getPropertyValue(java.lang.String,java.lang.String)
-     */
-    public String getPropertyValue(String layout, String propName)
+    public String getProperty(String propName)
     {
         return null;
     }
     
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.page.Fragment#getPropertyValue(java.lang.String,java.lang.String,java.lang.String)
-     */
-    public void setPropertyValue(String layout, String propName, String value)
-    {
-    }
-    
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.page.Fragment#addProperty(org.apache.jetspeed.om.page.Property)
-     */
-    public void addProperty(Property p)
-    {
-    }
-    
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.page.Fragment#removeProperty(org.apache.jetspeed.om.page.Property)
-     */
-    public void removeProperty(Property p)
-    {
-    }
-    
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.page.Fragment#clearProperties(java.lang.String)
+     * @see org.apache.jetspeed.om.page.Fragment#getIntProperty(java.lang.String)
      */
-    public void clearProperties(String layoutName)
+    public int getIntProperty(String propName)
     {
+        return -1;
     }
     
     /* (non-Javadoc)

Modified: portals/jetspeed-2/trunk/etc/schema/phase2-schema.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/etc/schema/phase2-schema.xml?rev=330134&r1=330133&r2=330134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/etc/schema/phase2-schema.xml (original)
+++ portals/jetspeed-2/trunk/etc/schema/phase2-schema.xml Tue Nov  1 14:13:18 2005
@@ -27,6 +27,14 @@
         <column name="PATH" required="true" size="160" type="VARCHAR"/>
         <column name="NAME" required="true" size="80" type="VARCHAR"/>
         <column name="TITLE" size="100" type="VARCHAR"/>
+        <column name="SUBSITE" required="true" size="40" type="VARCHAR"/>
+        <column name="USER_PRINCIPAL" required="true" size="40" type="VARCHAR"/>
+        <column name="ROLE_PRINCIPAL" required="true" size="40" type="VARCHAR"/>
+        <column name="GROUP_PRINCIPAL" required="true" size="40" type="VARCHAR"/>
+        <column name="MEDIATYPE" required="true" size="15" type="VARCHAR"/>
+        <column name="LOCALE" required="true" size="10" type="VARCHAR"/>
+        <column name="EXT_ATTR_NAME" required="true" size="15" type="VARCHAR"/>
+        <column name="EXT_ATTR_VALUE" required="true" size="40" type="VARCHAR"/>
 		<foreign-key foreignTable="FOLDER" onDelete="cascade">
 			<reference foreign="FOLDER_ID" local="PARENT_ID"/>
 		</foreign-key>
@@ -35,6 +43,14 @@
 		</index>
 		<unique name="UN_FOLDER_1">
 			<unique-column name="PATH"/>
+			<unique-column name="SUBSITE"/>
+			<unique-column name="USER_PRINCIPAL"/>
+			<unique-column name="ROLE_PRINCIPAL"/>
+			<unique-column name="GROUP_PRINCIPAL"/>
+			<unique-column name="MEDIATYPE"/>
+			<unique-column name="LOCALE"/>
+			<unique-column name="EXT_ATTR_NAME"/>
+			<unique-column name="EXT_ATTR_VALUE"/>
 		</unique>
     </table>
     
@@ -51,13 +67,14 @@
         <column name="SKIN" size="80" type="VARCHAR"/>
         <column name="DECORATOR" size="80" type="VARCHAR"/>
         <column name="DEFAULT_FRAGMENT_DECORATOR" size="80" type="VARCHAR"/>
-        <column name="SUBSITE" size="40" type="VARCHAR"/>
-        <column name="PRINCIPAL" size="40" type="VARCHAR"/>
-        <column name="PRINCIPAL_TYPE" size="15" type="VARCHAR"/>
-        <column name="MEDIATYPE" size="15" type="VARCHAR"/>
-        <column name="LOCALE" size="10" type="VARCHAR"/>
-        <column name="EXT_LOCATOR_NAME" size="15" type="VARCHAR"/>
-        <column name="EXT_LOCATOR_VALUE" size="40" type="VARCHAR"/>
+        <column name="SUBSITE" required="true" size="40" type="VARCHAR"/>
+        <column name="USER_PRINCIPAL" required="true" size="40" type="VARCHAR"/>
+        <column name="ROLE_PRINCIPAL" required="true" size="40" type="VARCHAR"/>
+        <column name="GROUP_PRINCIPAL" required="true" size="40" type="VARCHAR"/>
+        <column name="MEDIATYPE" required="true" size="15" type="VARCHAR"/>
+        <column name="LOCALE" required="true" size="10" type="VARCHAR"/>
+        <column name="EXT_ATTR_NAME" required="true" size="15" type="VARCHAR"/>
+        <column name="EXT_ATTR_VALUE" required="true" size="40" type="VARCHAR"/>
 		<foreign-key foreignTable="FOLDER" onDelete="cascade">
 			<reference foreign="FOLDER_ID" local="PARENT_ID"/>
 		</foreign-key>
@@ -67,12 +84,13 @@
 		<unique name="UN_PAGE_1">
 			<unique-column name="PATH"/>
 			<unique-column name="SUBSITE"/>
-			<unique-column name="PRINCIPAL"/>
-			<unique-column name="PRINCIPAL_TYPE"/>
+			<unique-column name="USER_PRINCIPAL"/>
+			<unique-column name="ROLE_PRINCIPAL"/>
+			<unique-column name="GROUP_PRINCIPAL"/>
 			<unique-column name="MEDIATYPE"/>
 			<unique-column name="LOCALE"/>
-			<unique-column name="EXT_LOCATOR_NAME"/>
-			<unique-column name="EXT_LOCATOR_VALUE"/>
+			<unique-column name="EXT_ATTR_NAME"/>
+			<unique-column name="EXT_ATTR_VALUE"/>
 		</unique>
     </table>
     
@@ -93,10 +111,10 @@
         <column name="LAYOUT_ROW" type="INTEGER"/>
         <column name="LAYOUT_COLUMN" type="INTEGER"/>
         <column name="LAYOUT_SIZES" size="20" type="VARCHAR"/>
-        <column name="EXT_PROPERTY_NAME_1" size="40" type="VARCHAR"/>
-        <column name="EXT_PROPERTY_VALUE_1" size="80" type="VARCHAR"/>
-        <column name="EXT_PROPERTY_NAME_2" size="40" type="VARCHAR"/>
-        <column name="EXT_PROPERTY_VALUE_2" size="80" type="VARCHAR"/>
+        <column name="EXT_PROP_NAME_1" size="40" type="VARCHAR"/>
+        <column name="EXT_PROP_VALUE_1" size="80" type="VARCHAR"/>
+        <column name="EXT_PROP_NAME_2" size="40" type="VARCHAR"/>
+        <column name="EXT_PROP_VALUE_2" size="80" type="VARCHAR"/>
 		<foreign-key foreignTable="FRAGMENT" onDelete="cascade">
 			<reference foreign="FRAGMENT_ID" local="PARENT_ID"/>
 		</foreign-key>

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/folder/Folder.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/folder/Folder.java?rev=330134&r1=330133&r2=330134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/folder/Folder.java (original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/folder/Folder.java Tue Nov  1 14:13:18 2005
@@ -40,11 +40,46 @@
 
     String FALLBACK_DEFAULT_PAGE = "default-page.psml";
     String PAGE_NOT_FOUND_PAGE = "page_not_found.psml";
-    String USER_FOLDER = "/_user/";
-    String ROLE_FOLDER = "/_role/";
-    String GROUP_FOLDER = "/_group/";
+    
+    String RESERVED_SUBSITE_FOLDER_PREFIX = "__";
+    String RESERVED_SUBSITE_FOLDER_NAME = RESERVED_SUBSITE_FOLDER_PREFIX + "subsite-root";
+    String RESERVED_FOLDER_PREFIX = "_";
+    String RESERVED_USER_FOLDER_NAME = RESERVED_FOLDER_PREFIX + "user";
+    String RESERVED_ROLE_FOLDER_NAME = RESERVED_FOLDER_PREFIX + "role";
+    String RESERVED_GROUP_FOLDER_NAME = RESERVED_FOLDER_PREFIX + "group";
+    String RESERVED_MEDIATYPE_FOLDER_NAME = RESERVED_FOLDER_PREFIX + "mediatype";
+    String RESERVED_LANGUAGE_FOLDER_NAME = RESERVED_FOLDER_PREFIX + "language";
+    String RESERVED_COUNTRY_FOLDER_NAME = RESERVED_FOLDER_PREFIX + "country";
+    
+    String SUBSITE_FOLDER = PATH_SEPARATOR + RESERVED_SUBSITE_FOLDER_NAME + PATH_SEPARATOR;
+    String USER_FOLDER = PATH_SEPARATOR + RESERVED_USER_FOLDER_NAME + PATH_SEPARATOR;
+    String ROLE_FOLDER = PATH_SEPARATOR + RESERVED_ROLE_FOLDER_NAME + PATH_SEPARATOR;
+    String GROUP_FOLDER = PATH_SEPARATOR + RESERVED_GROUP_FOLDER_NAME + PATH_SEPARATOR;
+    String MEDIATYPE_FOLDER = PATH_SEPARATOR + RESERVED_MEDIATYPE_FOLDER_NAME + PATH_SEPARATOR;
+    String LANGUAGE_FOLDER = PATH_SEPARATOR + RESERVED_LANGUAGE_FOLDER_NAME + PATH_SEPARATOR;
+    String COUNTRY_FOLDER = PATH_SEPARATOR + RESERVED_COUNTRY_FOLDER_NAME + PATH_SEPARATOR;
+
+    int RESERVED_FOLDER_NONE = 0;    
+    int RESERVED_FOLDER_SUBSITES = 1;
+    int RESERVED_FOLDER_USERS = 2;
+    int RESERVED_FOLDER_ROLES = 3;
+    int RESERVED_FOLDER_GROUPS = 4;
+    int RESERVED_FOLDER_MEDIATYPE = 5;
+    int RESERVED_FOLDER_LANGUAGE = 6;
+    int RESERVED_FOLDER_COUNTRY = 7;
+    int RESERVED_FOLDER_OTHER = 9999;
     
     /**
+     * isRootFolder
+     *
+     * Tests whether this folder's path is a root folder based on the
+     * rules associated with the folder implementation;
+     *
+     * @return flag indicating whether folder path is a root path
+     */
+    boolean isRootFolder();
+
+    /**
      * 
      * <p>
      * getDefaultPage
@@ -235,15 +270,4 @@
      * @return one of the valid reserved folder types
      */
     int getReservedType();
-
-    int RESERVED_FOLDER_NONE = 0;    
-    int RESERVED_FOLDER_SUBSITES = 1;
-    int RESERVED_FOLDER_USERS = 2;
-    int RESERVED_FOLDER_ROLES = 3;
-    int RESERVED_FOLDER_GROUPS = 4;
-    int RESERVED_FOLDER_MEDIATYPE = 5;
-    int RESERVED_FOLDER_LANGUAGE = 6;
-    int RESERVED_FOLDER_COUNTRY = 7;
-    int RESERVED_FOLDER_OTHER = 9999;
-    
 }

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/page/Fragment.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/page/Fragment.java?rev=330134&r1=330133&r2=330134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/page/Fragment.java (original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/page/Fragment.java Tue Nov  1 14:13:18 2005
@@ -17,6 +17,7 @@
 package org.apache.jetspeed.om.page;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>A <code>Fragment</code> is the basic element handled by the aggregation
@@ -37,8 +38,7 @@
  * the fragment also stores contextual information used for rendering:</p>
  * <p>Finally the fragment also holds layout and rendering properties that
  *   may be used by a parent fragment to layout all its inner fragments in
- *   an appropriate fashion. These properties are always defined for a
- *   specific named component.</p>
+ *   an appropriate fashion.</p>
  *
  * @version $Id$
  */
@@ -152,67 +152,33 @@
     public List getFragments();
 
     /**
-     * Returns all layout names for which properties have
-     * been defined.
+     * getProperty
      *
-     * @return a list of layout names Strings
-     */
-    public List getLayoutProperties();
-
-    /**
-     * Returns a list of all properties defined
-     * for the layoutName specified. You can update the properties
-     * but not add or remove them
+     * Get named property value.
      *
-     * @return an immutable List of Property objects
+     * @param propName property name
+     * @return value
      */
-    public List getProperties(String layoutName);
+    public String getProperty(String propName);
     
     /**
-     * 
-     * <p>
-     * getPropertyValue
-     * </p>
-     *
-     * @param layout
-     * @param propName
-     * @return
-     */
-    public String getPropertyValue(String layout, String propName);
-    
-    /**
-     * 
-     * <p>
-     * setPropertyValue
-     * </p>
+     * getIntProperty
      *
-     * @param layout
-     * @param propName
-     * @param value
-     */
-    public void setPropertyValue(String layout, String propName, String value);
-
-    /**
-     * Adds a new property to this fragment
+     * Get named property value as integer.
      *
-     * @param p the new Property to add
+     * @param propName property name
+     * @return int value
      */
-    public void addProperty(Property p);
-
+    public int getIntProperty(String propName);
+    
     /**
-     * Removes a new property from this fragment
+     * getProperties
      *
-     * @param p the Property to remove
-     */
-    public void removeProperty(Property p);
-
-    /**
-     * Clear all the properties for a specific layout,
-     * if layoutName is null, clear all properties.
+     * Get writable Map of properties by name.
      *
-     * @param layoutName the layout for which to remove the properties
+     * @return properties map
      */
-    public void clearProperties(String layoutName);
+    public Map getProperties();
 
     /**
      * get layout row property
@@ -222,6 +188,13 @@
     public int getLayoutRow();
     
     /**
+     * set the layout row property
+     * 
+     * @param row
+     */
+    public void setLayoutRow(int row);
+    
+    /**
      * get layout column property
      *
      * @return column layout property
@@ -236,12 +209,12 @@
     public void setLayoutColumn(int column);
     
     /**
-     * set the layout row property
-     * 
-     * @param row
-     */
-    public void setLayoutRow(int row);
-    
+     * get layout sizes property, (i.e. "25%,75%")
+     *
+     * @return sizes layout property
+     **/
+    public String getLayoutSizes();
+
     /**
      * set the layout sizes
      * 
@@ -249,13 +222,6 @@
      */
     public void setLayoutSizes(String sizes);
     
-    /**
-     * get layout sizes property, (i.e. "25%,75%")
-     *
-     * @return sizes layout property
-     **/
-    public String getLayoutSizes();
-
     /**
      * Test if this fragment is actually a reference to an external fragment.
      *

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/page/PageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/page/PageManager.java?rev=330134&r1=330133&r2=330134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/page/PageManager.java (original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/page/PageManager.java Tue Nov  1 14:13:18 2005
@@ -32,7 +32,6 @@
 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.om.page.Property;
 import org.apache.jetspeed.page.document.DocumentException;
 import org.apache.jetspeed.page.document.DocumentNotFoundException;
 import org.apache.jetspeed.page.document.NodeException;
@@ -102,13 +101,6 @@
      */    
     public Fragment newPortletFragment();
     
-    /**
-     * Creates a new empty Property instance
-     *
-     * @return a newly created Property object
-     */
-    public Property newProperty();
-
     /**
      * newMenuDefinition - creates a new empty menu definition
      *

Modified: portals/jetspeed-2/trunk/layout-portlets/src/java/org/apache/jetspeed/portlets/layout/ColumnLayout.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/layout-portlets/src/java/org/apache/jetspeed/portlets/layout/ColumnLayout.java?rev=330134&r1=330133&r2=330134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/layout-portlets/src/java/org/apache/jetspeed/portlets/layout/ColumnLayout.java (original)
+++ portals/jetspeed-2/trunk/layout-portlets/src/java/org/apache/jetspeed/portlets/layout/ColumnLayout.java Tue Nov  1 14:13:18 2005
@@ -730,8 +730,7 @@
      */
     protected final int getRow(int currentColumn, Fragment fragment)
     {
-        String propertyValue = fragment.getPropertyValue(layoutType, Fragment.ROW_PROPERTY_NAME);
-
+        String propertyValue = fragment.getProperty(Fragment.ROW_PROPERTY_NAME);
         if (propertyValue != null)
         {
             return Integer.parseInt(propertyValue);
@@ -757,7 +756,7 @@
      */
     protected final int getColumn(Fragment fragment)
     {
-        String propertyValue = fragment.getPropertyValue(layoutType, Fragment.COLUMN_PROPERTY_NAME);
+        String propertyValue = fragment.getProperty(Fragment.COLUMN_PROPERTY_NAME);
         if (propertyValue != null)
         {
             int columnNumber = Integer.parseInt(propertyValue);

Modified: portals/jetspeed-2/trunk/layout-portlets/src/java/org/apache/jetspeed/portlets/layout/MultiColumnPortlet.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/layout-portlets/src/java/org/apache/jetspeed/portlets/layout/MultiColumnPortlet.java?rev=330134&r1=330133&r2=330134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/layout-portlets/src/java/org/apache/jetspeed/portlets/layout/MultiColumnPortlet.java (original)
+++ portals/jetspeed-2/trunk/layout-portlets/src/java/org/apache/jetspeed/portlets/layout/MultiColumnPortlet.java Tue Nov  1 14:13:18 2005
@@ -109,7 +109,7 @@
         List columnSizes = this.columnSizes;
 
         // Determine custom column sizes in the psml
-        String customSizes = f.getPropertyValue(this.layoutType, Fragment.SIZES_PROPERTY_NAME);
+        String customSizes = f.getProperty(Fragment.SIZES_PROPERTY_NAME);
         if ( customSizes != null && customSizes.trim().length() > 0 )
         {
             columnSizes = getCellSizes(customSizes);

Modified: portals/jetspeed-2/trunk/layout-portlets/src/java/org/apache/jetspeed/portlets/layout/PageManagerLayoutEventListener.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/layout-portlets/src/java/org/apache/jetspeed/portlets/layout/PageManagerLayoutEventListener.java?rev=330134&r1=330133&r2=330134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/layout-portlets/src/java/org/apache/jetspeed/portlets/layout/PageManagerLayoutEventListener.java (original)
+++ portals/jetspeed-2/trunk/layout-portlets/src/java/org/apache/jetspeed/portlets/layout/PageManagerLayoutEventListener.java Tue Nov  1 14:13:18 2005
@@ -32,8 +32,8 @@
             {
                 Fragment fragment = event.getFragment();
                 LayoutCoordinate coordinate = event.getNewCoordinate();
-                fragment.setPropertyValue(layoutType, "column", String.valueOf(coordinate.getX()));
-                fragment.setPropertyValue(layoutType, "row", String.valueOf(coordinate.getY()));
+                fragment.getProperties().put(Fragment.COLUMN_PROPERTY_NAME, String.valueOf(coordinate.getX()));
+                fragment.getProperties().put(Fragment.ROW_PROPERTY_NAME, String.valueOf(coordinate.getY()));
                 pageManager.updatePage(page);
             }
         }



---------------------------------------------------------------------
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