portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r331191 [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 Mon, 07 Nov 2005 03:55:35 GMT
Propchange: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageSecurityImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageSecuritySecurityConstraintsDef.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageSecuritySecurityConstraintsDef.java?rev=331191&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageSecuritySecurityConstraintsDef.java (added)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageSecuritySecurityConstraintsDef.java Sun Nov  6 19:55:13 2005
@@ -0,0 +1,47 @@
+/*
+ * 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.om.page.impl;
+
+/**
+ * PageSecuritySecurityConstraintsDef
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+public class PageSecuritySecurityConstraintsDef extends BaseSecurityConstraint
+{
+    private String name;
+
+    /**
+     * getName
+     *
+     * @return name of defined constraint
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+    /**
+     * setName
+     *
+     * @param name name of defined constraint
+     */
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+}

Propchange: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageSecuritySecurityConstraintsDef.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/SecurityConstraintsImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/SecurityConstraintsImpl.java?rev=331191&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/SecurityConstraintsImpl.java (added)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/SecurityConstraintsImpl.java Sun Nov  6 19:55:13 2005
@@ -0,0 +1,259 @@
+/*
+ * 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.om.page.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.jetspeed.om.common.SecurityConstraint;
+import org.apache.jetspeed.om.common.SecurityConstraints;
+import org.apache.jetspeed.om.page.SecurityConstraintImpl;
+
+/**
+ * SecurityConstraintsImpl
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+public class SecurityConstraintsImpl implements SecurityConstraints
+{
+    private String owner;
+    private List constraints;
+    private List constraintsRefs;
+
+    private List securityConstraints;
+    private List securityConstraintsRefs;
+
+    /**
+     * beforeUpdate
+     *
+     * Update persistent constraints using transient constraints.
+     */
+    public void beforeUpdate()
+    {
+        // synchronize persistent constraints
+        if ((securityConstraints != null) && !securityConstraints.isEmpty())
+        {
+            // update constraints collection size
+            if (constraints == null)
+            {
+                constraints = new ArrayList(securityConstraints.size());
+            }
+            while (constraints.size() < securityConstraints.size())
+            {
+                BaseSecurityConstraint constraint = newSecurityConstraint();
+                constraint.setApplyOrder(constraints.size());
+                constraints.add(constraint);
+            }
+            while (constraints.size() > securityConstraints.size())
+            {
+                constraints.remove(constraints.size()-1);
+            }
+            // update constraints
+            Iterator updateIter0 = securityConstraints.iterator();
+            Iterator updateIter1 = constraints.iterator();
+            while (updateIter0.hasNext() && updateIter1.hasNext())
+            {
+                SecurityConstraint securityConstraint = (SecurityConstraint)updateIter0.next();
+                BaseSecurityConstraint constraint = (BaseSecurityConstraint)updateIter1.next();
+                constraint.setUserPrincipals(securityConstraint.getUsersList());
+                constraint.setRolePrincipals(securityConstraint.getRolesList());
+                constraint.setGroupPrincipals(securityConstraint.getGroupsList());
+                constraint.setPermissions(securityConstraint.getPermissionsList());
+            }
+        }
+        else
+        {
+            // empty constraints collection
+            if (constraints != null)
+            {
+                constraints.clear();
+            }
+        }
+
+        // synchronize persistent constraints references
+        if ((securityConstraintsRefs != null) && !securityConstraintsRefs.isEmpty())
+        {
+            // update constraints references collection size
+            if (constraintsRefs == null)
+            {
+                constraintsRefs = new ArrayList(securityConstraintsRefs.size());
+            }
+            while (constraintsRefs.size() < securityConstraintsRefs.size())
+            {
+                BaseSecurityConstraintsRef constraintsRef = newSecurityConstraintsRef();
+                constraintsRef.setApplyOrder(constraintsRefs.size());
+                constraintsRefs.add(constraintsRef);
+            }
+            while (constraintsRefs.size() > securityConstraintsRefs.size())
+            {
+                constraintsRefs.remove(constraintsRefs.size()-1);
+            }
+            // update constraints references
+            Iterator updateIter0 = securityConstraintsRefs.iterator();
+            Iterator updateIter1 = constraintsRefs.iterator();
+            while (updateIter0.hasNext() && updateIter1.hasNext())
+            {
+                String securityConstraintsRef = (String)updateIter0.next();
+                BaseSecurityConstraintsRef constraintsRef = (BaseSecurityConstraintsRef)updateIter1.next();
+                constraintsRef.setName(securityConstraintsRef);
+            }
+        }
+        else
+        {
+            // empty constraints references collection
+            if (constraintsRefs != null)
+            {
+                constraintsRefs.clear();
+            }
+        }
+    }
+
+    /**
+     * afterLookup
+     *
+     * Update transient constraints from persistent constraints.
+     */
+    public void afterLookup()
+    {
+        // synchronize constraints
+        if ((constraints != null) && !constraints.isEmpty())
+        {
+            // initialize security constraints collection
+            if (securityConstraints == null)
+            {
+                securityConstraints = new ArrayList(constraints.size());
+            }
+            else
+            {
+                securityConstraints.clear();
+            }
+            // construct security constraints
+            Iterator updateIter = constraints.iterator();
+            while (updateIter.hasNext())
+            {
+                BaseSecurityConstraint constraint = (BaseSecurityConstraint)updateIter.next();
+                SecurityConstraint securityConstraint = new SecurityConstraintImpl();
+                securityConstraint.setUsers(constraint.getUserPrincipals());
+                securityConstraint.setRoles(constraint.getRolePrincipals());
+                securityConstraint.setGroups(constraint.getGroupPrincipals());
+                securityConstraint.setPermissions(constraint.getPermissions());
+                securityConstraints.add(securityConstraint);
+            }
+        }
+        else
+        {
+            // remove security constraints collection
+            securityConstraints = null;
+        }
+
+        // synchronize constraints references
+        if ((constraintsRefs != null) && !constraintsRefs.isEmpty())
+        {
+            // update security constraints references
+            if (securityConstraintsRefs == null)
+            {
+                securityConstraintsRefs = new ArrayList(constraintsRefs.size());
+            }
+            else
+            {
+                securityConstraintsRefs.clear();
+            }
+            Iterator updateIter = constraintsRefs.iterator();
+            while (updateIter.hasNext())
+            {
+                BaseSecurityConstraintsRef constraintsRef = (BaseSecurityConstraintsRef)updateIter.next();
+                securityConstraintsRefs.add(constraintsRef.getName());
+            }
+        }
+        else
+        {
+            // remove security constraints references collection
+            securityConstraintsRefs = null;
+        }
+    }
+
+    /**
+     * newSecurityConstraint
+     *
+     * Create new persistent constraint instance.
+     */
+    public BaseSecurityConstraint newSecurityConstraint()
+    {
+        // transient by default
+        return null;
+    }
+
+    /**
+     * newSecurityConstraintsRef
+     *
+     * Create new persistent constraints reference instance.
+     */
+    public BaseSecurityConstraintsRef newSecurityConstraintsRef()
+    {
+        // transient by default
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecurityConstraints#getOwner()
+     */
+    public String getOwner()
+    {
+        return owner;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecurityConstraints#setOwner(java.lang.String)
+     */
+    public void setOwner(String owner)
+    {
+        this.owner = owner;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecurityConstraints#getSecurityConstraints()
+     */
+    public List getSecurityConstraints()
+    {
+        return securityConstraints;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecurityConstraints#setSecurityConstraints(java.util.List)
+     */
+    public void setSecurityConstraints(List constraints)
+    {
+        securityConstraints = constraints;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecurityConstraints#getSecurityConstraintsRefs()
+     */
+    public List getSecurityConstraintsRefs()
+    {
+        return securityConstraintsRefs;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecurityConstraints#setSecurityConstraintsRefs(java.util.List)
+     */
+    public void setSecurityConstraintsRefs(List constraintsRefs)
+    {
+        securityConstraintsRefs = constraintsRefs;
+    }
+}

Propchange: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/SecurityConstraintsImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/AbstractBaseElement.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/AbstractBaseElement.java?rev=331191&r1=331190&r2=331191&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/AbstractBaseElement.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/AbstractBaseElement.java Sun Nov  6 19:55:13 2005
@@ -30,6 +30,7 @@
 import org.apache.jetspeed.om.common.SecuredResource;
 import org.apache.jetspeed.om.common.SecurityConstraints;
 import org.apache.jetspeed.om.page.BaseElement;
+import org.apache.jetspeed.om.page.SecurityConstraintImpl;
 import org.apache.jetspeed.page.document.DocumentHandlerFactory;
 import org.apache.jetspeed.page.document.Node;
 import org.apache.jetspeed.page.document.NodeSet;

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/FragmentImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/FragmentImpl.java?rev=331191&r1=331190&r2=331191&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/FragmentImpl.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/FragmentImpl.java Sun Nov  6 19:55:13 2005
@@ -111,36 +111,36 @@
     public Vector getPropertiesList()
     {
         return (Vector) this.propertiesList;
-            }
-
+    }
+    
     /**
-     * @see org.apache.jetspeed.om.page.Fragment#getProperty(java.lang.String,java.lang.String)
+     * @see org.apache.jetspeed.om.page.Fragment#getProperty(java.lang.String)
      */
     public String getProperty(String propName)
     {
         return (String)propertiesMap.get(propName);
-        }
-
+    }
+    
     /**
-     * @see org.apache.jetspeed.om.page.Fragment#getProperty(java.lang.String,java.lang.String)
+     * @see org.apache.jetspeed.om.page.Fragment#getIntProperty(java.lang.String)
      */
     public int getIntProperty(String propName)
-        {
+    {
         String prop = (String)propertiesMap.get(propName);
         if (prop != null)
-            {
+        {
             return Integer.parseInt(prop);
-            }
-        return -1;
         }
-
+        return -1;
+    }
+    
     /**
      * @see org.apache.jetspeed.om.page.Fragment#getProperties()
      */
     public Map getProperties()
     {
         return propertiesMap;
-            }
+    }
 
     /**
      * @see org.apache.jetspeed.om.page.Fragment#getLayoutRow()
@@ -151,7 +151,7 @@
         if (prop != null)
         {
             return Integer.parseInt(prop);
-            }
+        }
         return -1;
     }
 
@@ -165,10 +165,10 @@
             propertiesMap.put(ROW_PROPERTY_NAME, String.valueOf(row));
         }
         else
-            {
+        {
             propertiesMap.remove(ROW_PROPERTY_NAME);
-            }
         }
+    }
     
     /**
      * @see org.apache.jetspeed.om.page.Fragment#getLayoutColumn()
@@ -179,7 +179,7 @@
         if (prop != null)
         {
             return Integer.parseInt(prop);
-            }
+        }
         return -1;
     }
 
@@ -193,10 +193,10 @@
             propertiesMap.put(COLUMN_PROPERTY_NAME, String.valueOf(column));
         }
         else
-            {
+        {
             propertiesMap.remove(COLUMN_PROPERTY_NAME);
-            }
         }
+    }
     
     /**
      * @see org.apache.jetspeed.om.page.Fragment#getLayoutSizes()
@@ -204,7 +204,7 @@
     public String getLayoutSizes()
     {
         return (String)propertiesMap.get(SIZES_PROPERTY_NAME);
-            }
+    }
     
     /**
      * @see org.apache.jetspeed.om.page.Fragment#setLayoutSizes(java.lang.String)
@@ -216,10 +216,10 @@
             propertiesMap.put(SIZES_PROPERTY_NAME, sizes);
         }
         else
-            {
+        {
             propertiesMap.remove(SIZES_PROPERTY_NAME);
-            }
         }
+    }
     
     public Object clone() throws java.lang.CloneNotSupportedException
     {
@@ -381,4 +381,4 @@
         // notify super class implementation
         super.marshalling();
     }
-}
\ No newline at end of file
+}

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/SecurityConstraintsImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/SecurityConstraintsImpl.java?rev=331191&r1=331190&r2=331191&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/SecurityConstraintsImpl.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/SecurityConstraintsImpl.java Sun Nov  6 19:55:13 2005
@@ -22,6 +22,7 @@
 import org.apache.jetspeed.om.common.SecurityConstraints;
 import org.apache.jetspeed.om.folder.Folder;
 import org.apache.jetspeed.om.page.PageSecurity;
+import org.apache.jetspeed.om.page.SecurityConstraintImpl;
 import org.apache.jetspeed.om.page.SecurityConstraintsDef;
 import org.apache.jetspeed.page.document.DocumentHandlerFactory;
 import org.apache.jetspeed.page.PageNotFoundException;

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java?rev=331191&r1=331190&r2=331191&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java Sun Nov  6 19:55:13 2005
@@ -38,6 +38,8 @@
 import org.apache.jetspeed.om.page.Fragment;
 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.SecurityConstraintsDef;
 import org.apache.jetspeed.page.document.Node;
 import org.apache.jetspeed.portalsite.MenuElement;
 
@@ -56,6 +58,7 @@
     protected Class pageClass;
     protected Class folderClass;
     protected Class linkClass;
+    protected Class pageSecurityClass;
     protected Class propertyClass;
     protected Class menuDefinitionClass;
     protected Class menuExcludeDefinitionClass;
@@ -64,6 +67,7 @@
     protected Class menuSeparatorDefinitionClass;
     protected Class securityConstraintsClass;
     protected Class securityConstraintClass;
+    protected Class securityConstraintsDefClass;
 
     private boolean permissionsEnabled;
 
@@ -85,6 +89,7 @@
         this.pageClass = (Class)modelClasses.get("PageImpl.class");
         this.folderClass = (Class)modelClasses.get("FolderImpl.class");
         this.linkClass = (Class)modelClasses.get("LinkImpl.class");
+        this.pageSecurityClass = (Class)modelClasses.get("PageSecurityImpl.class");
         this.menuDefinitionClass = (Class)modelClasses.get("MenuDefinitionImpl.class");
         this.menuExcludeDefinitionClass = (Class)modelClasses.get("MenuExcludeDefinitionImpl.class");
         this.menuIncludeDefinitionClass = (Class)modelClasses.get("MenuIncludeDefinitionImpl.class");
@@ -92,6 +97,7 @@
         this.menuSeparatorDefinitionClass = (Class)modelClasses.get("MenuSeparatorDefinitionImpl.class");
         this.securityConstraintsClass = (Class)modelClasses.get("SecurityConstraintsImpl.class");
         this.securityConstraintClass = (Class)modelClasses.get("SecurityConstraintImpl.class");
+        this.securityConstraintsDefClass = (Class)modelClasses.get("SecurityConstraintsDefImpl.class");
     }
     
     /**
@@ -204,6 +210,26 @@
     }
     
     /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#newPageSecurity()
+     */
+    public PageSecurity newPageSecurity()
+    {
+        PageSecurity pageSecurity = null;
+        try
+        {
+            // factory create the document and set id/path
+            pageSecurity = (PageSecurity)createObject(this.pageSecurityClass);            
+            pageSecurity.setPath(Folder.PATH_SEPARATOR + PageSecurity.DOCUMENT_TYPE);
+        }
+        catch (ClassCastException e)
+        {
+            String message = "Failed to create page security object for " + this.pageClass;
+            log.error(message, e);
+        }
+        return pageSecurity;        
+    }
+    
+    /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#newFragment()
      */
     public Fragment newFragment()
@@ -374,6 +400,25 @@
     }
 
     /**
+     * newSecurityConstraintsDef - creates a new security constraints definition
+     *
+     * @return a newly created SecurityConstraintsDef object
+     */
+    public SecurityConstraintsDef newSecurityConstraintsDef()
+    {
+        try
+        {
+            return (SecurityConstraintsDef)createObject(this.securityConstraintsDefClass);
+        }
+        catch (ClassCastException e)
+        {
+            String message = "Failed to create security constraints definition object for " + this.securityConstraintsDefClass;
+            log.error(message, e);
+        }
+        return null;
+    }
+
+    /**
      * createObject - creates a new page manager implementation object
      *
      * @param classe implementation class
@@ -413,6 +458,14 @@
     {
         // remove listener from listeners list
         listeners.remove(listener);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#reset()
+     */
+    public void reset()
+    {
+        // nothing to reset by default
     }
 
     /**

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/DelegatingPageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/DelegatingPageManager.java?rev=331191&r1=331190&r2=331191&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/DelegatingPageManager.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/DelegatingPageManager.java Sun Nov  6 19:55:13 2005
@@ -11,6 +11,8 @@
 import org.apache.jetspeed.om.page.Page;
 import org.apache.jetspeed.om.page.PageSecurity;
 import org.apache.jetspeed.page.document.DocumentNotFoundException;
+import org.apache.jetspeed.page.document.FailedToDeleteDocumentException;
+import org.apache.jetspeed.page.document.FailedToUpdateDocumentException;
 import org.apache.jetspeed.page.document.NodeException;
 import org.apache.jetspeed.page.document.UnsupportedDocumentTypeException;
 
@@ -143,4 +145,23 @@
 
     }
 
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#updatePageSecurity(org.apache.jetspeed.om.page.PageSecurity)
+     */
+    public void updatePageSecurity(PageSecurity pageSecurity) throws
+            JetspeedException, FailedToUpdateDocumentException
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#removePageSecurity(org.apache.jetspeed.om.page.PageSecurity)
+     */
+    public void removePageSecurity(PageSecurity pageSecurity) throws
+            JetspeedException, FailedToDeleteDocumentException
+    {
+        // TODO Auto-generated method stub
+
+    }
 }

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/impl/NodeImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/impl/NodeImpl.java?rev=331191&r1=331190&r2=331191&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/impl/NodeImpl.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/impl/NodeImpl.java Sun Nov  6 19:55:13 2005
@@ -16,13 +16,14 @@
 package org.apache.jetspeed.page.document.impl;
 
 import java.util.ArrayList;
-import java.util.List;
+import java.util.Collection;
 import java.util.Locale;
 
 import org.apache.jetspeed.om.common.GenericMetadata;
 import org.apache.jetspeed.om.folder.Folder;
 import org.apache.jetspeed.om.page.PageMetadataImpl;
 import org.apache.jetspeed.om.page.impl.BaseElementImpl;
+import org.apache.jetspeed.om.page.impl.SecurityConstraintsImpl;
 import org.apache.jetspeed.page.document.Node;
 
 /**
@@ -35,15 +36,14 @@
 {
     private Node parent;
     private boolean hidden;
-    private NodeAttributes attributes;
-    private List metadataFields;
+    private Collection metadataFields;
+    private NodeAttributes attributes = new NodeAttributes();
 
     private PageMetadataImpl pageMetadata;
 
-    public NodeImpl()
+    public NodeImpl(SecurityConstraintsImpl constraints)
     {
-        super();
-        attributes = new NodeAttributes();
+        super(constraints);
     }
 
     /**
@@ -67,7 +67,11 @@
      * @param fields mutable fields collection
      * @return page metadata
      */
-    public abstract PageMetadataImpl newPageMetadata(List fields);
+    public PageMetadataImpl newPageMetadata(Collection fields)
+    {
+        // no metadata available by default
+        return null;
+    }
 
     /**
      * getPageMetadata

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=331191&r1=331190&r2=331191&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 Sun Nov  6 19:55:13 2005
@@ -38,8 +38,13 @@
 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.SecurityConstraintImpl;
+import org.apache.jetspeed.om.page.SecurityConstraintsDef;
+import org.apache.jetspeed.om.page.SecurityConstraintsDefImpl;
 import org.apache.jetspeed.om.page.impl.FragmentImpl;
 import org.apache.jetspeed.om.page.impl.PageImpl;
+import org.apache.jetspeed.om.page.impl.PageSecurityImpl;
+import org.apache.jetspeed.om.page.impl.SecurityConstraintsImpl;
 import org.apache.jetspeed.page.DelegatingPageManager;
 import org.apache.jetspeed.page.FolderNotRemovedException;
 import org.apache.jetspeed.page.FolderNotUpdatedException;
@@ -51,6 +56,8 @@
 import org.apache.jetspeed.page.PageNotRemovedException;
 import org.apache.jetspeed.page.PageNotUpdatedException;
 import org.apache.jetspeed.page.document.DocumentNotFoundException;
+import org.apache.jetspeed.page.document.FailedToDeleteDocumentException;
+import org.apache.jetspeed.page.document.FailedToUpdateDocumentException;
 import org.apache.jetspeed.page.document.NodeException;
 import org.apache.jetspeed.page.document.UnsupportedDocumentTypeException;
 import org.apache.jetspeed.page.document.impl.NodeAttributes;
@@ -77,13 +84,15 @@
         modelClasses.put("PageImpl.class", PageImpl.class);
         modelClasses.put("FolderImpl.class", FolderImpl.class);
         //modelClasses.put("LinkImpl.class", LinkImpl.class);
+        modelClasses.put("PageSecurityImpl.class", PageSecurityImpl.class);
         //modelClasses.put("MenuDefinitionImpl.class", MenuDefinitionImpl.class);
         //modelClasses.put("MenuExcludeDefinitionImpl.class", MenuExcludeDefinitionImpl.class);
         //modelClasses.put("MenuIncludeDefinitionImpl.class", MenuIncludeDefinitionImpl.class);
         //modelClasses.put("MenuOptionsDefinitionImpl.class", MenuOptionsDefinitionImpl.class);
         //modelClasses.put("MenuSeparatorDefinitionImpl.class", MenuSeparatorDefinitionImpl.class);
-        //modelClasses.put("SecurityConstraintsImpl.class", SecurityConstraintsImpl.class);
-        //modelClasses.put("SecurityConstraintImpl.class", SecurityConstraintImpl.class);
+        modelClasses.put("SecurityConstraintsImpl.class", SecurityConstraintsImpl.class);
+        modelClasses.put("SecurityConstraintImpl.class", SecurityConstraintImpl.class);
+        modelClasses.put("SecurityConstraintsDefImpl.class", SecurityConstraintsDefImpl.class);
     }
 
     private DelegatingPageManager delegator;
@@ -138,6 +147,14 @@
     }
 
     /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#newPageSecurity()
+     */
+    public PageSecurity newPageSecurity()
+    {
+        return delegator.newPageSecurity();
+    }
+
+    /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#newFragment()
      */
     public Fragment newFragment()
@@ -207,6 +224,43 @@
     }
 
     /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#newSecurityConstraintsDef()
+     */
+    public SecurityConstraintsDef newSecurityConstraintsDef()
+    {
+        return delegator.newSecurityConstraintsDef();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#addListener(org.apache.jetspeed.page.PageManagerEventListener)
+     */
+    public void addListener(PageManagerEventListener listener)
+    {
+        delegator.addListener(listener);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#removeListener(org.apache.jetspeed.page.PageManagerEventListener)
+     */
+    public void removeListener(PageManagerEventListener listener)
+    {
+        delegator.removeListener(listener);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#reset()
+     */
+    public void reset()
+    {
+        // propagate to delegator
+        delegator.reset();
+
+        // clean database node cache to force subsequent
+        // refreshs from persistent store
+        databaseNodeCache.clear();
+    }
+
+    /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#getPage(java.lang.String)
      */
     public Page getPage(String path) throws PageNotFoundException, NodeException
@@ -273,8 +327,44 @@
      */
     public PageSecurity getPageSecurity() throws DocumentNotFoundException, UnsupportedDocumentTypeException, FolderNotFoundException, NodeException
     {
-        // TODO Auto-generated method stub
-        return null;
+        // construct document attributes from path
+        String path = Folder.PATH_SEPARATOR + PageSecurity.DOCUMENT_TYPE;
+        NodeAttributes attributes = new NodeAttributes(path);
+        path = attributes.getCanonicalPath();
+
+        // test cache with canonical path if available
+        if (databaseNodeCache.containsKey(path))
+        {
+            // return cached document or throw exception if cached as null
+            PageSecurity document = (PageSecurity) databaseNodeCache.get(path);
+            if (document == null)
+            {
+                throw new DocumentNotFoundException("Document " + path + " not found.");
+            }
+            return document;
+        }
+        
+        // retrieve document from database
+        try
+        {
+            Criteria filter = attributes.newQueryCriteria();
+            QueryByCriteria query = QueryFactory.newQuery(PageSecurityImpl.class, filter);
+            PageSecurity document = (PageSecurity) getPersistenceBrokerTemplate().getObjectByQuery(query);
+            
+            // add to or delete entry in document cache
+            databaseNodeCache.put(path, document);
+            
+            // return page or throw exception
+            if (document == null)
+            {
+                throw new DocumentNotFoundException("Document " + path + " not found.");
+            }
+            return document;
+        }
+        catch (Exception e)
+        {
+            throw new DocumentNotFoundException("Document " + path + " not found.", e);
+        }
     }
 
     /* (non-Javadoc)
@@ -521,23 +611,90 @@
     }
 
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.page.PageManager#addListener(org.apache.jetspeed.page.PageManagerEventListener)
+     * @see org.apache.jetspeed.page.PageManager#updatePageSecurity(org.apache.jetspeed.om.page.PageSecurity)
      */
-    public void addListener(PageManagerEventListener listener)
+    public void updatePageSecurity(PageSecurity pageSecurity) throws JetspeedException, FailedToUpdateDocumentException
     {
-        // TODO Auto-generated method stub
+        try
+        {
+            // dereference document in case proxy is supplied
+            pageSecurity = (PageSecurity)ProxyHelper.getRealObject(pageSecurity);
 
+            // look up and set parent folder if necessary
+            if (pageSecurity.getParent() == null)
+            {
+                // access folder by path
+                String pageSecurityPath = pageSecurity.getPath();
+                String parentPath = pageSecurityPath.substring(0, pageSecurityPath.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 FailedToUpdateDocumentException("Missing parent folder: " + parentPath);
+                }
+                
+                // update parent folder with added document
+                parent.setPageSecurity((PageSecurityImpl)pageSecurity);
+                pageSecurity.setParent(parent);
+                getPersistenceBrokerTemplate().store(parent);
+                
+                // update document cache
+                databaseNodeCache.put(pageSecurityPath, pageSecurity);
+            }
+            else
+            {
+                // update document
+                getPersistenceBrokerTemplate().store(pageSecurity);
+                
+                // update document cache
+                databaseNodeCache.put(pageSecurity.getPath(), pageSecurity);
+            }
+        }
+        catch (Exception e)
+        {
+            throw new FailedToUpdateDocumentException("Document " + pageSecurity.getPath() + " not updated.", e);
+        }
     }
 
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.page.PageManager#removeListener(org.apache.jetspeed.page.PageManagerEventListener)
+     * @see org.apache.jetspeed.page.PageManager#removePageSecurity(org.apache.jetspeed.om.page.PageSecurity)
      */
-    public void removeListener(PageManagerEventListener listener)
+    public void removePageSecurity(PageSecurity pageSecurity) throws JetspeedException, FailedToDeleteDocumentException
     {
-        // TODO Auto-generated method stub
+        try
+        {
+            // dereference document in case proxy is supplied
+            pageSecurity = (PageSecurity)ProxyHelper.getRealObject(pageSecurity);
 
+            // look up and update parent folder if necessary
+            if (pageSecurity.getParent() != null)
+            {
+                // update parent folder with removed document; deletes document
+                FolderImpl parent = (FolderImpl)ProxyHelper.getRealObject(pageSecurity.getParent());
+                parent.setPageSecurity(null);
+                getPersistenceBrokerTemplate().store(parent);
+            }
+            else
+            {
+                // delete document
+                getPersistenceBrokerTemplate().delete(pageSecurity);
+            }
+            
+            // delete document cache entry
+            databaseNodeCache.put(pageSecurity.getPath(), null);
+        }
+        catch (Exception e)
+        {
+            throw new FailedToDeleteDocumentException("Document " + pageSecurity.getPath() + " not removed.", e);
+        }
     }
-
 
     public Page copyPage(Page source, String path)
     throws JetspeedException, PageNotUpdatedException

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=331191&r1=331190&r2=331191&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 Sun Nov  6 19:55:13 2005
@@ -44,16 +44,20 @@
 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.SecurityConstraintImpl;
+import org.apache.jetspeed.om.page.SecurityConstraintsDefImpl;
 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.SecurityConstraintImpl;
+import org.apache.jetspeed.om.page.psml.PageSecurityImpl;
 import org.apache.jetspeed.om.page.psml.SecurityConstraintsImpl;
 import org.apache.jetspeed.page.AbstractPageManager;
 import org.apache.jetspeed.page.PageManager;
 import org.apache.jetspeed.page.PageNotFoundException;
 import org.apache.jetspeed.page.document.DocumentHandlerFactory;
 import org.apache.jetspeed.page.document.DocumentNotFoundException;
+import org.apache.jetspeed.page.document.FailedToDeleteDocumentException;
+import org.apache.jetspeed.page.document.FailedToUpdateDocumentException;
 import org.apache.jetspeed.page.document.FolderHandler;
 import org.apache.jetspeed.page.document.Node;
 import org.apache.jetspeed.page.document.NodeException;
@@ -79,6 +83,7 @@
         modelClasses.put("PageImpl.class", PageImpl.class);
         modelClasses.put("FolderImpl.class", FolderImpl.class);
         modelClasses.put("LinkImpl.class", LinkImpl.class);
+        modelClasses.put("PageSecurityImpl.class", PageSecurityImpl.class);
         modelClasses.put("MenuDefinitionImpl.class", MenuDefinitionImpl.class);
         modelClasses.put("MenuExcludeDefinitionImpl.class", MenuExcludeDefinitionImpl.class);
         modelClasses.put("MenuIncludeDefinitionImpl.class", MenuIncludeDefinitionImpl.class);
@@ -86,6 +91,7 @@
         modelClasses.put("MenuSeparatorDefinitionImpl.class", MenuSeparatorDefinitionImpl.class);
         modelClasses.put("SecurityConstraintsImpl.class", SecurityConstraintsImpl.class);
         modelClasses.put("SecurityConstraintImpl.class", SecurityConstraintImpl.class);
+        modelClasses.put("SecurityConstraintsDefImpl.class", SecurityConstraintsDefImpl.class);
     }
 
     private IdGenerator generator = null;
@@ -374,6 +380,22 @@
         return folder.getPageSecurity();
     }
 
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#updatePageSecurity(org.apache.jetspeed.om.page.PageSecurity)
+     */
+    public void updatePageSecurity(PageSecurity pageSecurity) throws JetspeedException, FailedToUpdateDocumentException
+    {
+        throw new FailedToUpdateDocumentException("Document " + pageSecurity.getPath() + " not updated, update not implemented.");
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#removePageSecurity(org.apache.jetspeed.om.page.PageSecurity)
+     */
+    public void removePageSecurity(PageSecurity pageSecurity) throws JetspeedException, FailedToDeleteDocumentException
+    {
+        throw new FailedToDeleteDocumentException("Document " + pageSecurity.getPath() + " not removed, remove not implemented.");
+    }
+
     /**
      * <p>
      * getFolder
@@ -478,6 +500,15 @@
 
         // notify page manager listeners
         notifyRemovedNode(folder);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#reset()
+     */
+    public void reset()
+    {
+        // propagate
+        super.reset();
     }
 
     /**

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=331191&r1=331190&r2=331191&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 Sun Nov  6 19:55:13 2005
@@ -15,14 +15,22 @@
  */
 package org.apache.jetspeed.page;
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Locale;
 
 import org.apache.jetspeed.components.test.AbstractSpringTestCase;
 import org.apache.jetspeed.om.common.GenericMetadata;
+import org.apache.jetspeed.om.common.SecurityConstraint;
+import org.apache.jetspeed.om.common.SecurityConstraints;
 import org.apache.jetspeed.om.folder.Folder;
 import org.apache.jetspeed.om.folder.FolderNotFoundException;
 import org.apache.jetspeed.om.page.Fragment;
 import org.apache.jetspeed.om.page.Page;
+import org.apache.jetspeed.om.page.PageSecurity;
+import org.apache.jetspeed.om.page.SecurityConstraintsDef;
+import org.apache.jetspeed.page.document.DocumentNotFoundException;
+import org.apache.jetspeed.page.document.FailedToUpdateDocumentException;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -36,6 +44,9 @@
  */
 public class TestDatabasePageManager extends AbstractSpringTestCase
 {
+    private String testAttributesPath = "/__subsite-rootX/_user/userX/_role/roleX/_group/groupX/_mediatype/xhtml/_language/en/_country/us/_custom/customX";
+    private String verifyTestAttributesPath = "/__subsite-rootx/_user/userx/_role/rolex/_group/groupx/_mediatype/xhtml/_language/en/_country/us/_custom/customx";
+
     private PageManager pageManager;
     
     public static void main(String args[])
@@ -48,12 +59,10 @@
     {
         super.setUp();        
         pageManager = (PageManager)ctx.getBean("pageManager");
-        // createTestData();
     }
 
     protected void tearDown() throws Exception
     {
-        //dropTestData();
         super.tearDown();
     }
     
@@ -75,52 +84,38 @@
         { "test-repository-datasource-spring.xml" };
     }
 
-    public void xtestPages() throws Exception
-    {
-        boolean pageNotFound = false;
-        try
-        {
-            Page page = pageManager.getPage("/notfound.psml");
-        }
-        catch (PageNotFoundException e)
-        {
-            pageNotFound = true;
-        }
-        assertTrue("should have got a page not found error", pageNotFound);
-        
-        try
-        {
-            Page page = pageManager.getPage("/default-page.psml");
-        }
-        catch (PageNotFoundException e)
-        {
-            fail("should have found root default page");                    
-        }
-    }
-    
-    public void xtestFolders() throws Exception
-    {
-        try
-        {
-            Folder folder = pageManager.getFolder("/");
-        }
-        catch (FolderNotFoundException e)
-        {
-            fail("should have found root folder");                    
-        }
-    }
-        
     public void testCreates()
     {
         try
         {
-            // test basic folder/page/fragment creation
+            // reset page manager cache
+            pageManager.reset();
+
+            // test document and folder creation
             Folder folder = pageManager.newFolder("/");
             folder.setTitle("Root Folder");
             folder.setDefaultPage("default-page.psml");
             folder.setShortTitle("Root");
             GenericMetadata metadata = folder.getMetadata();
             metadata.addField(Locale.FRENCH, "title", "[fr] Root Folder");
+            SecurityConstraints folderConstraints = pageManager.newSecurityConstraints();
+            folderConstraints.setOwner("admin");
+            List inlineFolderConstraints = new ArrayList(2);
+            SecurityConstraint folderConstraint = pageManager.newSecurityConstraint();
+            folderConstraint.setUsers("user,admin");
+            folderConstraint.setRoles("manager");
+            folderConstraint.setGroups("*");
+            folderConstraint.setPermissions("view,edit");
+            inlineFolderConstraints.add(folderConstraint);
+            folderConstraint = pageManager.newSecurityConstraint();
+            folderConstraint.setPermissions("edit");
+            inlineFolderConstraints.add(folderConstraint);
+            folderConstraints.setSecurityConstraints(inlineFolderConstraints);
+            List folderConstraintsRefs = new ArrayList(2);
+            folderConstraintsRefs.add("public-view");
+            folderConstraintsRefs.add("public-edit");
+            folderConstraints.setSecurityConstraintsRefs(folderConstraintsRefs);
+            folder.setSecurityConstraints(folderConstraints);
             pageManager.updateFolder(folder);
             
             assertNull(folder.getParent());
@@ -134,6 +129,18 @@
             metadata = page.getMetadata();
             metadata.addField(Locale.FRENCH, "title", "[fr] Default Page");
             metadata.addField(Locale.JAPANESE, "title", "[ja] Default Page");
+            SecurityConstraints pageConstraints = pageManager.newSecurityConstraints();
+            pageConstraints.setOwner("user");
+            List inlinePageConstraints = new ArrayList(1);
+            SecurityConstraint pageConstraint = pageManager.newSecurityConstraint();
+            pageConstraint.setUsers("jetspeed");
+            pageConstraint.setPermissions("edit");
+            inlinePageConstraints.add(pageConstraint);
+            pageConstraints.setSecurityConstraints(inlinePageConstraints);
+            List pageConstraintsRefs = new ArrayList(1);
+            pageConstraintsRefs.add("manager-edit");
+            pageConstraints.setSecurityConstraintsRefs(pageConstraintsRefs);
+            page.setSecurityConstraints(pageConstraints);
 
             Fragment root = page.getRootFragment();
             root.setDecorator("blue-gradient");
@@ -159,40 +166,70 @@
             assertNotNull(page.getParent());
             assertEquals(page.getParent().getId(), folder.getId());
 
+            PageSecurity pageSecurity = pageManager.newPageSecurity();
+            List constraintsDefs = new ArrayList(2);
+            SecurityConstraintsDef constraintsDef = pageManager.newSecurityConstraintsDef();
+            constraintsDef.setName("public-view");
+            List defConstraints = new ArrayList(1);
+            SecurityConstraint defConstraint = pageManager.newSecurityConstraint();
+            defConstraint.setUsers("*");
+            defConstraint.setPermissions("view");
+            defConstraints.add(defConstraint);
+            constraintsDef.setSecurityConstraints(defConstraints);
+            constraintsDefs.add(constraintsDef);
+            constraintsDef = pageManager.newSecurityConstraintsDef();
+            constraintsDef.setName("admin-all");
+            defConstraints = new ArrayList(2);
+            defConstraint = pageManager.newSecurityConstraint();
+            defConstraint.setRoles("admin");
+            defConstraint.setPermissions("view,edit");
+            defConstraints.add(defConstraint);
+            defConstraint = pageManager.newSecurityConstraint();
+            defConstraint.setRoles("nobody");
+            defConstraints.add(defConstraint);
+            constraintsDef.setSecurityConstraints(defConstraints);
+            constraintsDefs.add(constraintsDef);
+            pageSecurity.setSecurityConstraintsDefs(constraintsDefs);
+            List globalConstraintsRefs = new ArrayList(2);
+            globalConstraintsRefs.add("admin-all");
+            globalConstraintsRefs.add("public-view");
+            pageSecurity.setGlobalSecurityConstraintsRefs(globalConstraintsRefs);
+
+            pageManager.updatePageSecurity(pageSecurity);
+
+            assertNotNull(pageSecurity.getParent());
+            assertEquals(pageSecurity.getParent().getId(), folder.getId());
+
+            // test duplicate creates
             try
             {
-                Page check = pageManager.getPage("/default-page.psml");
-                assertEquals("/default-page.psml", check.getPath());
+                Folder dupFolder = pageManager.newFolder("/");
+                pageManager.updateFolder(dupFolder);
+                assertTrue("Duplicate Folder / CREATED", false);
             }
-            catch (PageNotFoundException e)
+            catch (FolderNotUpdatedException e)
             {
-                assertTrue("Page /default-page.psml NOT FOUND", false);
             }
             try
             {
-                Folder checkFolder = pageManager.getFolder("/");
-                assertEquals("/", checkFolder.getPath());
+                Page dupPage = pageManager.newPage("/default-page.psml");
+                pageManager.updatePage(dupPage);
+                assertTrue("Duplicate Page / CREATED", false);
             }
-            catch (FolderNotFoundException e)
+            catch (PageNotUpdatedException e)
             {
-                assertTrue("Folder / NOT FOUND", false);
             }
             try
             {
-                Folder checkFolder = pageManager.newFolder("/");
-                pageManager.updateFolder(checkFolder);
-                assertTrue("Duplicate Folder / CREATED", false);
+                PageSecurity dupPageSecurity = pageManager.newPageSecurity();
+                pageManager.updatePageSecurity(dupPageSecurity);
+                assertTrue("Duplicate PageSecurity / CREATED", false);
             }
-            catch (FolderNotUpdatedException e)
+            catch (FailedToUpdateDocumentException e)
             {
-                assertTrue("Duplicate Folder / NOT CREATED", true);
             }
 
-            pageManager.removeFolder(folder);
-
             // test folder/page creation with attributes
-            String testAttributesPath = "/__subsite-rootX/_user/userX/_role/roleX/_group/groupX/_mediatype/xhtml/_language/en/_country/us/_custom/customX";
-            String verifyTestAttributesPath = "/__subsite-rootx/_user/userx/_role/rolex/_group/groupx/_mediatype/xhtml/_language/en/_country/us/_custom/customx";
             folder = pageManager.newFolder(testAttributesPath);
             pageManager.updateFolder(folder);
             assertNull(folder.getParent());
@@ -202,56 +239,192 @@
 
             assertNotNull(page.getParent());
             assertEquals(page.getParent().getId(), folder.getId());
+        }
+        catch (Exception e)
+        {
+            fail("testCreates failed: "+e);
+            e.printStackTrace(System.out);
+        }
+    }
+    
+    public void testGets()
+    {
+        try
+        {
+            // reset page manager cache
+            pageManager.reset();
 
+            // read documents and folders from persisted store
             try
             {
-                Page check = pageManager.getPage(testAttributesPath + "/default-page.psml");
-                assertEquals(verifyTestAttributesPath + "/default-page.psml", check.getPath());
+                PageSecurity check = pageManager.getPageSecurity();
+                assertEquals("/page.security", check.getPath());
+                assertEquals("page.security", check.getName());
+                assertNotNull(check.getSecurityConstraintsDefs());
+                assertEquals(2, check.getSecurityConstraintsDefs().size());
+                assertEquals("admin-all", ((SecurityConstraintsDef)check.getSecurityConstraintsDefs().get(0)).getName());
+                assertNotNull(((SecurityConstraintsDef)check.getSecurityConstraintsDefs().get(0)).getSecurityConstraints());
+                assertEquals(2, ((SecurityConstraintsDef)check.getSecurityConstraintsDefs().get(0)).getSecurityConstraints().size());
+                assertEquals("view,edit", ((SecurityConstraint)((SecurityConstraintsDef)check.getSecurityConstraintsDefs().get(0)).getSecurityConstraints().get(0)).getPermissions());
+                assertEquals("public-view", ((SecurityConstraintsDef)check.getSecurityConstraintsDefs().get(1)).getName());
+                assertNotNull(((SecurityConstraintsDef)check.getSecurityConstraintsDefs().get(1)).getSecurityConstraints());
+                assertEquals(1, ((SecurityConstraintsDef)check.getSecurityConstraintsDefs().get(1)).getSecurityConstraints().size());
+                assertEquals("view", ((SecurityConstraint)((SecurityConstraintsDef)check.getSecurityConstraintsDefs().get(1)).getSecurityConstraints().get(0)).getPermissions());
+                assertNotNull(check.getGlobalSecurityConstraintsRefs());
+                assertEquals(2, check.getGlobalSecurityConstraintsRefs().size());
+                assertEquals("admin-all", (String)check.getGlobalSecurityConstraintsRefs().get(0));
+                assertEquals("public-view", (String)check.getGlobalSecurityConstraintsRefs().get(1));
+            }
+            catch (DocumentNotFoundException e)
+            {
+                assertTrue("PageSecurity NOT FOUND", false);
+            }
+            try
+            {
+                Page check = pageManager.getPage("/default-page.psml");
+                assertEquals("/default-page.psml", check.getPath());
+                assertEquals("default-page.psml", check.getName());
+                assertEquals("Default Page", check.getTitle());
+                assertEquals("tigris", check.getDefaultDecorator(Fragment.LAYOUT));
+                assertEquals("blue-gradient", check.getDefaultDecorator(Fragment.PORTLET));
+                assertEquals("skin-1", check.getDefaultSkin());
+                assertEquals("Default", check.getShortTitle());
+                assertNotNull(check.getMetadata());
+                assertEquals("[fr] Default Page", check.getTitle(Locale.FRENCH));
+                assertEquals("[ja] Default Page", check.getTitle(Locale.JAPANESE));
+                assertNotNull(check.getRootFragment());
+                assertEquals("blue-gradient", check.getRootFragment().getDecorator());
+                assertEquals("jetspeed-layouts::VelocityTwoColumns", check.getRootFragment().getName());
+                assertEquals("Root", check.getRootFragment().getShortTitle());
+                assertEquals("Root Fragment", check.getRootFragment().getTitle());
+                assertEquals("Normal", check.getRootFragment().getState());
+                assertEquals("50%,50%", check.getRootFragment().getLayoutSizes());
+                assertNotNull(check.getRootFragment().getProperties());
+                assertEquals("custom-prop-value1", check.getRootFragment().getProperty("custom-prop1"));
+                assertNotNull(check.getRootFragment().getFragments());
+                assertEquals(1, check.getRootFragment().getFragments().size());
+                assertEquals("security::LoginPortlet", ((Fragment)check.getRootFragment().getFragments().get(0)).getName());
+                assertEquals("Portlet", ((Fragment)check.getRootFragment().getFragments().get(0)).getShortTitle());
+                assertEquals("Portlet Fragment", ((Fragment)check.getRootFragment().getFragments().get(0)).getTitle());
+                assertEquals("Normal", ((Fragment)check.getRootFragment().getFragments().get(0)).getState());
+                assertEquals(88, ((Fragment)check.getRootFragment().getFragments().get(0)).getLayoutRow());
+                assertEquals(88, ((Fragment)check.getRootFragment().getFragments().get(0)).getIntProperty(Fragment.ROW_PROPERTY_NAME));
+                assertEquals(99, ((Fragment)check.getRootFragment().getFragments().get(0)).getLayoutColumn());
+                assertNotNull(check.getSecurityConstraints());
+                assertNotNull(check.getSecurityConstraints().getSecurityConstraintsRefs());
+                assertEquals(1, check.getSecurityConstraints().getSecurityConstraintsRefs().size());
+                assertEquals("manager-edit", (String)check.getSecurityConstraints().getSecurityConstraintsRefs().get(0));
+                assertNotNull(check.getSecurityConstraints().getSecurityConstraints());
+                assertEquals(1, check.getSecurityConstraints().getSecurityConstraints().size());
+                assertEquals("jetspeed", ((SecurityConstraint)check.getSecurityConstraints().getSecurityConstraints().get(0)).getUsers());
             }
             catch (PageNotFoundException e)
             {
-                assertTrue("Page " + testAttributesPath + "/default-page.psml NOT FOUND", false);
+                assertTrue("Page /default-page.psml NOT FOUND", false);
             }
             try
             {
-                Folder checkFolder = pageManager.getFolder(testAttributesPath);
-                assertEquals(verifyTestAttributesPath, checkFolder.getPath());
+                Folder check = pageManager.getFolder("/");
+                assertEquals("/", check.getPath());
+                assertEquals("/", check.getName());
+                assertEquals("Root Folder", check.getTitle());
+                assertEquals("default-page.psml", check.getDefaultPage());
+                assertEquals("Root", check.getShortTitle());
+                assertNotNull(check.getMetadata());
+                assertEquals("[fr] Root Folder", check.getTitle(Locale.FRENCH));
+                assertNotNull(check.getSecurityConstraints());
+                assertNotNull(check.getSecurityConstraints().getSecurityConstraintsRefs());
+                assertEquals(2, check.getSecurityConstraints().getSecurityConstraintsRefs().size());
+                assertEquals("public-edit", (String)check.getSecurityConstraints().getSecurityConstraintsRefs().get(1));
+                assertNotNull(check.getSecurityConstraints().getSecurityConstraints());
+                assertEquals(2, check.getSecurityConstraints().getSecurityConstraints().size());
+                assertEquals("user,admin", ((SecurityConstraint)check.getSecurityConstraints().getSecurityConstraints().get(0)).getUsers());
+                assertEquals("edit", ((SecurityConstraint)check.getSecurityConstraints().getSecurityConstraints().get(1)).getPermissions());
             }
             catch (FolderNotFoundException e)
             {
-                assertTrue("Folder " + testAttributesPath + " NOT FOUND", false);
+                assertTrue("Folder / NOT FOUND", false);
             }
             try
             {
-                Folder checkFolder = pageManager.newFolder(testAttributesPath);
-                pageManager.updateFolder(checkFolder);
-                assertTrue("Duplicate Folder " + testAttributesPath + " CREATED", false);
+                Page check = pageManager.getPage(testAttributesPath + "/default-page.psml");
+                assertEquals(verifyTestAttributesPath + "/default-page.psml", check.getPath());
             }
-            catch (FolderNotUpdatedException e)
+            catch (PageNotFoundException e)
             {
-                assertTrue("Duplicate Folder " + testAttributesPath + " NOT CREATED", true);
+                assertTrue("Page " + testAttributesPath + "/default-page.psml NOT FOUND", false);
+            }
+            try
+            {
+                Folder check = pageManager.getFolder(testAttributesPath);
+                assertEquals(verifyTestAttributesPath, check.getPath());
+            }
+            catch (FolderNotFoundException e)
+            {
+                assertTrue("Folder " + testAttributesPath + " NOT FOUND", false);
             }
-
-            pageManager.removeFolder(folder);
         }
         catch (Exception e)
         {
+            fail("testGets failed: "+e);
             e.printStackTrace(System.out);
-            fail("could not create test data: "+e);
         }
     }
-    
-    private void dropTestData()
+
+    public void testRemoves()
     {
         try
         {
-            Folder folder = pageManager.getFolder("/");
-            assertNotNull("folder should be found", folder);
-            pageManager.removeFolder(folder);
+            // reset page manager cache
+            pageManager.reset();
+
+            // remove root folders
+            try
+            {
+                Folder remove = pageManager.getFolder("/");
+                assertEquals("/", remove.getPath());
+                pageManager.removeFolder(remove);
+            }
+            catch (FolderNotFoundException e)
+            {
+                assertTrue("Folder / NOT FOUND", false);
+            }
+            try
+            {
+                Folder remove = pageManager.getFolder(testAttributesPath);
+                assertEquals(verifyTestAttributesPath, remove.getPath());
+                pageManager.removeFolder(remove);
+            }
+            catch (FolderNotFoundException e)
+            {
+                assertTrue("Folder " + testAttributesPath + " NOT FOUND", false);
+            }
+
+            // reset page manager cache
+            pageManager.reset();
+
+            // verify root folder removal
+            try
+            {
+                Folder check = pageManager.getFolder("/");
+                assertTrue("Folder / FOUND", false);
+            }
+            catch (FolderNotFoundException e)
+            {
+            }
+            try
+            {
+                Folder check = pageManager.getFolder(testAttributesPath);
+                assertTrue("Folder " + testAttributesPath + " FOUND", false);
+            }
+            catch (FolderNotFoundException e)
+            {
+            }
         }
         catch (Exception e)
         {
-            fail("could not remove test data: "+e);
+            fail("testRemoves failed: "+e);
+            e.printStackTrace(System.out);
         }
     }
 }

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=331191&r1=331190&r2=331191&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/etc/schema/phase2-schema.xml (original)
+++ portals/jetspeed-2/trunk/etc/schema/phase2-schema.xml Sun Nov  6 19:55:13 2005
@@ -38,6 +38,7 @@
         <column name="LOCALE" required="true" size="20" type="VARCHAR"/>
         <column name="EXT_ATTR_NAME" required="true" size="15" type="VARCHAR"/>
         <column name="EXT_ATTR_VALUE" required="true" size="40" type="VARCHAR"/>
+        <column name="OWNER_PRINCIPAL" size="40" type="VARCHAR"/>
 		<foreign-key foreignTable="FOLDER" onDelete="cascade">
 			<reference foreign="FOLDER_ID" local="PARENT_ID"/>
 		</foreign-key>
@@ -66,6 +67,9 @@
 		<foreign-key foreignTable="FOLDER" onDelete="cascade">
 			<reference foreign="FOLDER_ID" local="FOLDER_ID"/>
 		</foreign-key>
+		<index name="IX_FOLDER_METADATA_1">
+			<index-column name="FOLDER_ID"/>
+		</index>
 		<unique name="UN_FOLDER_METADATA_1">
 			<unique-column name="FOLDER_ID"/>
 			<unique-column name="NAME"/>
@@ -74,6 +78,35 @@
 		</unique>
     </table>
 
+    <table name="FOLDER_SECURITY_CONSTRAINT">
+        <column name="CONSTRAINT_ID" primaryKey="true" required="true" type="INTEGER"/>
+		<column name="FOLDER_ID" type="INTEGER" required="true"/>
+		<column name="APPLY_ORDER" type="INTEGER" required="true"/>
+        <column name="USER_PRINCIPALS_ACL" size="120" type="VARCHAR"/>
+        <column name="ROLE_PRINCIPALS_ACL" size="120" type="VARCHAR"/>
+        <column name="GROUP_PRINCIPALS_ACL" size="120" type="VARCHAR"/>
+        <column name="PERMISSIONS_ACL" size="120" type="VARCHAR"/>
+		<foreign-key foreignTable="FOLDER" onDelete="cascade">
+			<reference foreign="FOLDER_ID" local="FOLDER_ID"/>
+		</foreign-key>
+		<index name="IX_FOLDER_SECURITY_CONSTRAINT_1">
+			<index-column name="FOLDER_ID"/>
+		</index>
+    </table>
+
+    <table name="FOLDER_SECURITY_CONSTRAINTS_REF">
+        <column name="CONSTRAINTS_REF_ID" primaryKey="true" required="true" type="INTEGER"/>
+		<column name="FOLDER_ID" type="INTEGER" required="true"/>
+		<column name="APPLY_ORDER" type="INTEGER" required="true"/>
+        <column name="NAME" size="40" type="VARCHAR" required="true"/>
+		<foreign-key foreignTable="FOLDER" onDelete="cascade">
+			<reference foreign="FOLDER_ID" local="FOLDER_ID"/>
+		</foreign-key>
+		<index name="IX_FOLDER_SECURITY_CONSTRAINTS_REF_1">
+			<index-column name="FOLDER_ID"/>
+		</index>
+    </table>
+
     <!--
        Page Definition
     -->
@@ -97,6 +130,7 @@
         <column name="LOCALE" required="true" size="20" type="VARCHAR"/>
         <column name="EXT_ATTR_NAME" required="true" size="15" type="VARCHAR"/>
         <column name="EXT_ATTR_VALUE" required="true" size="40" type="VARCHAR"/>
+        <column name="OWNER_PRINCIPAL" size="40" type="VARCHAR"/>
 		<foreign-key foreignTable="FOLDER" onDelete="cascade">
 			<reference foreign="FOLDER_ID" local="PARENT_ID"/>
 		</foreign-key>
@@ -125,6 +159,9 @@
 		<foreign-key foreignTable="PAGE" onDelete="cascade">
 			<reference foreign="PAGE_ID" local="PAGE_ID"/>
 		</foreign-key>
+		<index name="IX_PAGE_METADATA_1">
+			<index-column name="PAGE_ID"/>
+		</index>
 		<unique name="UN_PAGE_METADATA_1">
 			<unique-column name="PAGE_ID"/>
 			<unique-column name="NAME"/>
@@ -133,6 +170,35 @@
 		</unique>
     </table>
 
+    <table name="PAGE_SECURITY_CONSTRAINT">
+        <column name="CONSTRAINT_ID" primaryKey="true" required="true" type="INTEGER"/>
+		<column name="PAGE_ID" type="INTEGER" required="true"/>
+		<column name="APPLY_ORDER" type="INTEGER" required="true"/>
+        <column name="USER_PRINCIPALS_ACL" size="120" type="VARCHAR"/>
+        <column name="ROLE_PRINCIPALS_ACL" size="120" type="VARCHAR"/>
+        <column name="GROUP_PRINCIPALS_ACL" size="120" type="VARCHAR"/>
+        <column name="PERMISSIONS_ACL" size="120" type="VARCHAR"/>
+		<foreign-key foreignTable="PAGE" onDelete="cascade">
+			<reference foreign="PAGE_ID" local="PAGE_ID"/>
+		</foreign-key>
+		<index name="IX_PAGE_SECURITY_CONSTRAINT_1">
+			<index-column name="PAGE_ID"/>
+		</index>
+    </table>
+
+    <table name="PAGE_SECURITY_CONSTRAINTS_REF">
+        <column name="CONSTRAINTS_REF_ID" primaryKey="true" required="true" type="INTEGER"/>
+		<column name="PAGE_ID" type="INTEGER" required="true"/>
+		<column name="APPLY_ORDER" type="INTEGER" required="true"/>
+        <column name="NAME" size="40" type="VARCHAR" required="true"/>
+		<foreign-key foreignTable="PAGE" onDelete="cascade">
+			<reference foreign="PAGE_ID" local="PAGE_ID"/>
+		</foreign-key>
+		<index name="IX_PAGE_SECURITY_CONSTRAINTS_REF_1">
+			<index-column name="PAGE_ID"/>
+		</index>
+    </table>
+
     <!--
        Fragment Definitions (portlets, layouts)
     -->
@@ -155,6 +221,7 @@
         <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"/>
+        <column name="OWNER_PRINCIPAL" size="40" type="VARCHAR"/>
 		<foreign-key foreignTable="FRAGMENT" onDelete="cascade">
 			<reference foreign="FRAGMENT_ID" local="PARENT_ID"/>
 		</foreign-key>
@@ -167,6 +234,101 @@
 		<unique name="UN_FRAGMENT_1">
 			<unique-column name="PAGE_ID"/>
 		</unique>
+    </table>
+
+    <table name="FRAGMENT_SECURITY_CONSTRAINT">
+        <column name="CONSTRAINT_ID" primaryKey="true" required="true" type="INTEGER"/>
+		<column name="FRAGMENT_ID" type="INTEGER" required="true"/>
+		<column name="APPLY_ORDER" type="INTEGER" required="true"/>
+        <column name="USER_PRINCIPALS_ACL" size="120" type="VARCHAR"/>
+        <column name="ROLE_PRINCIPALS_ACL" size="120" type="VARCHAR"/>
+        <column name="GROUP_PRINCIPALS_ACL" size="120" type="VARCHAR"/>
+        <column name="PERMISSIONS_ACL" size="120" type="VARCHAR"/>
+		<foreign-key foreignTable="FRAGMENT" onDelete="cascade">
+			<reference foreign="FRAGMENT_ID" local="FRAGMENT_ID"/>
+		</foreign-key>
+		<index name="IX_FRAGMENT_SECURITY_CONSTRAINT_1">
+			<index-column name="FRAGMENT_ID"/>
+		</index>
+    </table>
+
+    <table name="FRAGMENT_SECURITY_CONSTRAINTS_REF">
+        <column name="CONSTRAINTS_REF_ID" primaryKey="true" required="true" type="INTEGER"/>
+		<column name="FRAGMENT_ID" type="INTEGER" required="true"/>
+		<column name="APPLY_ORDER" type="INTEGER" required="true"/>
+        <column name="NAME" size="40" type="VARCHAR" required="true"/>
+		<foreign-key foreignTable="FRAGMENT" onDelete="cascade">
+			<reference foreign="FRAGMENT_ID" local="FRAGMENT_ID"/>
+		</foreign-key>
+		<index name="IX_FRAGMENT_SECURITY_CONSTRAINTS_REF_1">
+			<index-column name="FRAGMENT_ID"/>
+		</index>
+    </table>
+
+    <!--
+       Page Security Definition
+    -->
+
+    <table name="PAGE_SECURITY">
+        <column name="PAGE_SECURITY_ID" primaryKey="true" required="true" type="INTEGER"/>
+		<column name="PARENT_ID" type="INTEGER" required="true"/>
+        <column name="PATH" required="true" size="160" type="VARCHAR"/>
+        <column name="NAME" required="true" size="80" 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="20" 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>
+		<unique name="UN_PAGE_SECURITY_1">
+			<unique-column name="PARENT_ID"/>
+		</unique>
+		<unique name="UN_PAGE_SECURITY_2">
+			<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>
+    
+    <table name="PAGE_SECURITY_SECURITY_CONSTRAINTS_DEF">
+        <column name="CONSTRAINTS_DEF_ID" primaryKey="true" required="true" type="INTEGER"/>
+		<column name="PAGE_SECURITY_ID" type="INTEGER" required="true"/>
+        <column name="NAME" required="true" size="40" type="VARCHAR"/>
+		<column name="APPLY_ORDER" type="INTEGER" required="true"/>
+        <column name="USER_PRINCIPALS_ACL" size="120" type="VARCHAR"/>
+        <column name="ROLE_PRINCIPALS_ACL" size="120" type="VARCHAR"/>
+        <column name="GROUP_PRINCIPALS_ACL" size="120" type="VARCHAR"/>
+        <column name="PERMISSIONS_ACL" size="120" type="VARCHAR"/>
+		<foreign-key foreignTable="PAGE_SECURITY" onDelete="cascade">
+			<reference foreign="PAGE_SECURITY_ID" local="PAGE_SECURITY_ID"/>
+		</foreign-key>
+		<index name="IX_PAGE_SECURITY_CONSTRAINT_1">
+			<index-column name="PAGE_SECURITY_ID"/>
+		</index>
+    </table>
+
+    <table name="PAGE_SECURITY_GLOBAL_SECURITY_CONSTRAINTS_REF">
+        <column name="CONSTRAINTS_REF_ID" primaryKey="true" required="true" type="INTEGER"/>
+		<column name="PAGE_SECURITY_ID" type="INTEGER" required="true"/>
+		<column name="APPLY_ORDER" type="INTEGER" required="true"/>
+        <column name="NAME" size="40" type="VARCHAR" required="true"/>
+		<foreign-key foreignTable="PAGE_SECURITY" onDelete="cascade">
+			<reference foreign="PAGE_SECURITY_ID" local="PAGE_SECURITY_ID"/>
+		</foreign-key>
+		<index name="IX_PAGE_SECURITY_SECURITY_CONSTRAINTS_REF_1">
+			<index-column name="PAGE_SECURITY_ID"/>
+		</index>
     </table>
 
     <!--

Modified: portals/jetspeed-2/trunk/etc/sql/drop.sql
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/etc/sql/drop.sql?rev=331191&r1=331190&r2=331191&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/etc/sql/drop.sql (original)
+++ portals/jetspeed-2/trunk/etc/sql/drop.sql Sun Nov  6 19:55:13 2005
@@ -15,15 +15,27 @@
 DROP TABLE CLIENT_TO_MIMETYPE;
 DROP TABLE MEDIATYPE_TO_CAPABILITY;
 DROP TABLE MEDIATYPE_TO_MIMETYPE;
+
+DROP TABLE PAGE_SECURITY_SECURITY_GLOBAL_CONSTRAINTS_REF;
+DROP TABLE PAGE_SECURITY_SECURITY_CONSTRAINTS_DEF;
+DROP TABLE PAGE_SECURITY;
+DROP TABLE FRAGMENT_SECURITY_CONSTRAINTS_REF;
+DROP TABLE FRAGMENT_SECURITY_CONSTRAINT;
 DROP TABLE FRAGMENT;
+DROP TABLE PAGE_SECURITY_CONSTRAINTS_REF;
+DROP TABLE PAGE_SECURITY_CONSTRAINT;
 DROP TABLE PAGE_METADATA;
 DROP TABLE PAGE;
+DROP TABLE FOLDER_SECURITY_CONSTRAINTS_REF;
+DROP TABLE FOLDER_SECURITY_CONSTRAINT;
 DROP TABLE FOLDER_METADATA;
 DROP TABLE FOLDER;
+
 DROP TABLE RULE_CRITERION;
 DROP TABLE PRINCIPAL_RULE_ASSOC;
 DROP TABLE PROFILE_PAGE_ASSOC;
 DROP TABLE PROFILING_RULE;
+
 drop table PREFS_PROPERTY_VALUE;
 drop table PREFS_NODE_PROPERTY_KEY;
 drop table PREFS_PROPERTY_KEY;

Modified: portals/jetspeed-2/trunk/etc/sql/oracle/drop.sql
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/etc/sql/oracle/drop.sql?rev=331191&r1=331190&r2=331191&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/etc/sql/oracle/drop.sql (original)
+++ portals/jetspeed-2/trunk/etc/sql/oracle/drop.sql Sun Nov  6 19:55:13 2005
@@ -21,9 +21,18 @@
 DROP TABLE MEDIATYPE_TO_CAPABILITY;
 DROP TABLE MEDIATYPE_TO_MIMETYPE;
 
+DROP TABLE PAGE_SECURITY_SECURITY_GLOBAL_CONSTRAINTS_REF;
+DROP TABLE PAGE_SECURITY_SECURITY_CONSTRAINTS_DEF;
+DROP TABLE PAGE_SECURITY;
+DROP TABLE FRAGMENT_SECURITY_CONSTRAINTS_REF;
+DROP TABLE FRAGMENT_SECURITY_CONSTRAINT;
 DROP TABLE FRAGMENT;
+DROP TABLE PAGE_SECURITY_CONSTRAINTS_REF;
+DROP TABLE PAGE_SECURITY_CONSTRAINT;
 DROP TABLE PAGE_METADATA;
 DROP TABLE PAGE;
+DROP TABLE FOLDER_SECURITY_CONSTRAINTS_REF;
+DROP TABLE FOLDER_SECURITY_CONSTRAINT;
 DROP TABLE FOLDER_METADATA;
 DROP TABLE FOLDER;
 

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/common/SecurityConstraint.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/common/SecurityConstraint.java?rev=331191&r1=331190&r2=331191&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/common/SecurityConstraint.java (original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/common/SecurityConstraint.java Sun Nov  6 19:55:13 2005
@@ -63,6 +63,15 @@
 
     /**
      * <p>
+     * setUsers
+     * </p>
+     *
+     * @param users constraint list as List
+     */
+    void setUsers(List users);
+    
+    /**
+     * <p>
      * getRoles
      * </p>
      *
@@ -90,6 +99,15 @@
 
     /**
      * <p>
+     * setRoles
+     * </p>
+     *
+     * @param roles constraint list as List
+     */
+    void setRoles(List roles);
+    
+    /**
+     * <p>
      * getGroups
      * </p>
      *
@@ -117,6 +135,15 @@
 
     /**
      * <p>
+     * setGroups
+     * </p>
+     *
+     * @param groups constraint list as List
+     */
+    void setGroups(List groups);
+    
+    /**
+     * <p>
      * getPermissions
      * </p>
      *
@@ -138,7 +165,16 @@
      * setPermissions
      * </p>
      *
-     * @param permissions constraint list in CSV string form
+     * @param permissions constraint permissions list in CSV string form
      */
     void setPermissions(String permissions);
+
+    /**
+     * <p>
+     * setPermissions
+     * </p>
+     *
+     * @param permissions constraint permissions list as List
+     */
+    void setPermissions(List permissions);
 }

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=331191&r1=331190&r2=331191&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 Sun Nov  6 19:55:13 2005
@@ -32,8 +32,11 @@
 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.SecurityConstraintsDef;
 import org.apache.jetspeed.page.document.DocumentException;
 import org.apache.jetspeed.page.document.DocumentNotFoundException;
+import org.apache.jetspeed.page.document.FailedToDeleteDocumentException;
+import org.apache.jetspeed.page.document.FailedToUpdateDocumentException;
 import org.apache.jetspeed.page.document.NodeException;
 import org.apache.jetspeed.page.document.UnsupportedDocumentTypeException;
 
@@ -88,6 +91,13 @@
     public Link newLink(String path);
 
     /**
+     * Creates a new empty PageSecurity instance
+     *
+     * @return a newly created PageSecurity object
+     */
+    public PageSecurity newPageSecurity();
+
+    /**
      * Creates a new empty Layout Fragment instance
      *
      * @return a newly created Fragment object
@@ -150,6 +160,13 @@
      */
     public SecurityConstraint newSecurityConstraint();
 
+    /**
+     * newSecurityConstraintsDef - creates a new security constraints definition
+     *
+     * @return a newly created SecurityConstraintsDef object
+     */
+    public SecurityConstraintsDef newSecurityConstraintsDef();
+
    /**
     * 
     * <p>
@@ -256,10 +273,22 @@
 
     /** Remove a link.
      *
-     * @param page The link to be removed.
+     * @param link The link to be removed.
      */
     public void removeLink(Link link) throws JetspeedException, LinkNotRemovedException;
 
+    /** Update a page security document in persistent storage
+     *
+     * @param pageSecurity The document to be updated.
+     */
+    public void updatePageSecurity(PageSecurity pageSecurity) throws JetspeedException, FailedToUpdateDocumentException;
+
+    /** Remove a page security document.
+     *
+     * @param pageSecurity The document to be removed.
+     */
+    public void removePageSecurity(PageSecurity pageSecurity) throws JetspeedException, FailedToDeleteDocumentException;
+
     /**
      * addListener - add page manager event listener
      *
@@ -274,6 +303,11 @@
      */
     public void removeListener(PageManagerEventListener listener);
     
+    /**
+     * reset - force subsequent refresh from persistent store 
+     */
+    public void reset();
+
     /** 
      * Copy the source page creating and returning a new copy of the page  
      * with the same portlet and fragment collection as the source



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