portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r350178 - in /portals/jetspeed-2/trunk: components/page-manager/src/java/org/apache/jetspeed/om/page/ components/page-manager/src/java/org/apache/jetspeed/om/page/impl/ components/page-manager/src/java/org/apache/jetspeed/om/page/psml/ comp...
Date Thu, 01 Dec 2005 05:50:09 GMT
Author: rwatler
Date: Wed Nov 30 21:49:56 2005
New Revision: 350178

URL: http://svn.apache.org/viewcvs?rev=350178&view=rev
Log:
- extend SecuredResource and PageSecurity APIs to support
  specialized newSecurityConstraint*() construction
  methods to support PageManager implementations that
  require specific security om object implementations


Modified:
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentFragmentImpl.java
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentPageImpl.java
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/BaseElementImpl.java
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageSecurityImpl.java
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/AbstractBaseElement.java
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/PageSecurityImpl.java
    portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestCastorXmlPageManager.java
    portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestDatabasePageManager.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorFragmentImpl.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/common/SecuredResource.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/page/PageSecurity.java

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentFragmentImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentFragmentImpl.java?rev=350178&r1=350177&r2=350178&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentFragmentImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentFragmentImpl.java
Wed Nov 30 21:49:56 2005
@@ -11,6 +11,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.jetspeed.aggregator.PortletContent;
+import org.apache.jetspeed.om.common.SecurityConstraint;
 import org.apache.jetspeed.om.common.SecurityConstraints;
 
 public class ContentFragmentImpl implements ContentFragment
@@ -397,7 +398,24 @@
         fragment.setSecurityConstraints(constraints);
     }
     
-    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraints()
+     */
+    public SecurityConstraints newSecurityConstraints()
+    {
+        
+        return fragment.newSecurityConstraints();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraint()
+     */
+    public SecurityConstraint newSecurityConstraint()
+    {
+        
+        return fragment.newSecurityConstraint();
+    }
+
     /**
      * Checks the ContentFragment cache for a ContentFragment
      * that matches the <code>Id</code> of this fragment.  If

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentPageImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentPageImpl.java?rev=350178&r1=350177&r2=350178&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentPageImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentPageImpl.java
Wed Nov 30 21:49:56 2005
@@ -7,6 +7,7 @@
 import java.util.Map;
 
 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.page.document.Node;
 
@@ -353,6 +354,24 @@
     {
         
         page.setSecurityConstraints(constraints);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraints()
+     */
+    public SecurityConstraints newSecurityConstraints()
+    {
+        
+        return page.newSecurityConstraints();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraint()
+     */
+    public SecurityConstraint newSecurityConstraint()
+    {
+        
+        return page.newSecurityConstraint();
     }
 
     /* (non-Javadoc)

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/BaseElementImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/BaseElementImpl.java?rev=350178&r1=350177&r2=350178&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/BaseElementImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/BaseElementImpl.java
Wed Nov 30 21:49:56 2005
@@ -25,6 +25,7 @@
 import javax.security.auth.Subject;
 
 import org.apache.jetspeed.om.common.SecuredResource;
+import org.apache.jetspeed.om.common.SecurityConstraint;
 import org.apache.jetspeed.om.common.SecurityConstraints;
 import org.apache.jetspeed.om.page.BaseElement;
 import org.apache.jetspeed.om.page.PageSecurity;
@@ -245,13 +246,50 @@
      */
     public void setSecurityConstraints(SecurityConstraints constraints)
     {
-        // copy constraints to maintain persistent types
+        // copy constraints to maintain persistent
+        // collection members
         if (this.constraints != null)
         {
             this.constraints.setOwner(constraints.getOwner());
             this.constraints.setSecurityConstraints(constraints.getSecurityConstraints());
             this.constraints.setSecurityConstraintsRefs(constraints.getSecurityConstraintsRefs());
         }
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraints()
+     */
+    public SecurityConstraints newSecurityConstraints()
+    {
+        // return universal security constraints instance
+        // since object members are copied on assignment to
+        // maintain persistent collection members
+        return new SecurityConstraintsImpl();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraint()
+     */
+    public SecurityConstraint newSecurityConstraint()
+    {
+        // return constraints specific security constraint instance
+        if ((constraints != null) && (constraints.getSecurityConstraintClass() !=
null))
+        {
+            try
+            {
+                return (SecurityConstraintImpl)constraints.getSecurityConstraintClass().newInstance();
+            }
+            catch (InstantiationException ie)
+            {
+                throw new ClassCastException("Unable to create security constraint instance:
" + constraints.getSecurityConstraintClass().getName() + ", " + ie + ").");
+            }
+            catch (IllegalAccessException iae)
+            {
+                throw new ClassCastException("Unable to create security constraint instance:
" + constraints.getSecurityConstraintClass().getName() + ", " + iae + ").");
+            }
+        }
+        // return universal security constraint instance
+        return new SecurityConstraintImpl();
     }
 
     /* (non-Javadoc)

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageSecurityImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageSecurityImpl.java?rev=350178&r1=350177&r2=350178&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageSecurityImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageSecurityImpl.java
Wed Nov 30 21:49:56 2005
@@ -93,6 +93,15 @@
     }
 
     /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraint()
+     */
+    public SecurityConstraint newSecurityConstraint()
+    {
+        // return specific security constraint definition instance
+        return new PageSecuritySecurityConstraintImpl();
+    }
+
+    /* (non-Javadoc)
      * @see org.apache.jetspeed.om.page.PageSecurity#getSecurityConstraintsDefs()
      */
     public List getSecurityConstraintsDefs()
@@ -127,6 +136,15 @@
         }
         // clear cached security constraints definition map
         clearSecurityConstraintsDefsMap();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraintsDef()
+     */
+    public SecurityConstraintsDef newSecurityConstraintsDef()
+    {
+        // return specific security constraints definition instance
+        return new SecurityConstraintsDefImpl();
     }
 
     /* (non-Javadoc)

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=350178&r1=350177&r2=350178&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
Wed Nov 30 21:49:56 2005
@@ -28,6 +28,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.jetspeed.om.common.SecuredResource;
+import org.apache.jetspeed.om.common.SecurityConstraint;
 import org.apache.jetspeed.om.common.SecurityConstraints;
 import org.apache.jetspeed.om.page.BaseElement;
 import org.apache.jetspeed.om.page.SecurityConstraintImpl;
@@ -179,6 +180,32 @@
     public void setSecurityConstraints(SecurityConstraints constraints)
     {
         this.constraints = constraints;
+    }
+
+    /**
+     * <p>
+     * newSecurityConstraints
+     * </p>
+     *
+     * @see org.apache.jetspeed.om.common.SecureResource#newSecurityConstraints()
+     * @return security constraints
+     */
+    public SecurityConstraints newSecurityConstraints()
+    {
+        return new SecurityConstraintsImpl();
+    }
+
+    /**
+     * <p>
+     * newSecurityConstraint
+     * </p>
+     *
+     * @see org.apache.jetspeed.om.common.SecureResource#newSecurityConstraint()
+     * @return security constraint
+     */
+    public SecurityConstraint newSecurityConstraint()
+    {
+        return new SecurityConstraintImpl();
     }
 
     /**

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/PageSecurityImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/PageSecurityImpl.java?rev=350178&r1=350177&r2=350178&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/PageSecurityImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/PageSecurityImpl.java
Wed Nov 30 21:49:56 2005
@@ -84,6 +84,19 @@
 
     /**
      * <p>
+     * newSecurityConstraintsDef
+     * </p>
+     *
+     * @see org.apache.jetspeed.om.page.PageSecurity#newSecurityConstraintsDef()
+     * @return security constraints definition
+     */
+    public SecurityConstraintsDef newSecurityConstraintsDef()
+    {
+        return new SecurityConstraintsDefImpl();
+    }
+
+    /**
+     * <p>
      * getSecurityConstraintsDef
      * </p>
      *

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=350178&r1=350177&r2=350178&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
Wed Nov 30 21:49:56 2005
@@ -306,10 +306,10 @@
         properties.put(Fragment.COLUMN_PROPERTY_NAME, "0");
         root.getFragments().add(f);
 
-        SecurityConstraints constraints = pageManager.newSecurityConstraints();
+        SecurityConstraints constraints = page.newSecurityConstraints();
         constraints.setOwner("new-user");
         List constraintsList = new ArrayList(1);
-        SecurityConstraint constraint = pageManager.newSecurityConstraint();
+        SecurityConstraint constraint = page.newSecurityConstraint();
         constraint.setUsers(Shared.makeListFromCSV("user10,user11"));
         constraint.setRoles(Shared.makeListFromCSV("*"));
         constraint.setPermissions(Shared.makeListFromCSV(page.EDIT_ACTION + "," + page.VIEW_ACTION));

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=350178&r1=350177&r2=350178&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
Wed Nov 30 21:49:56 2005
@@ -152,7 +152,7 @@
         folderConstraint.setGroups(Shared.makeListFromCSV("*"));
         folderConstraint.setPermissions(Shared.makeListFromCSV("view,edit"));
         inlineFolderConstraints.add(folderConstraint);
-        folderConstraint = pageManager.newSecurityConstraint();
+        folderConstraint = folder.newSecurityConstraint();
         folderConstraint.setPermissions(Shared.makeListFromCSV("edit"));
         inlineFolderConstraints.add(folderConstraint);
         folderConstraints.setSecurityConstraints(inlineFolderConstraints);
@@ -179,10 +179,10 @@
         metadata = page.getMetadata();
         metadata.addField(Locale.FRENCH, "title", "[fr] Default Page");
         metadata.addField(Locale.JAPANESE, "title", "[ja] Default Page");
-        SecurityConstraints pageConstraints = pageManager.newSecurityConstraints();
+        SecurityConstraints pageConstraints = page.newSecurityConstraints();
         pageConstraints.setOwner("user");
         List inlinePageConstraints = new ArrayList(1);
-        SecurityConstraint pageConstraint = pageManager.newSecurityConstraint();
+        SecurityConstraint pageConstraint = page.newSecurityConstraint();
         pageConstraint.setUsers(Shared.makeListFromCSV("jetspeed"));
         pageConstraint.setPermissions(Shared.makeListFromCSV("edit"));
         inlinePageConstraints.add(pageConstraint);
@@ -233,7 +233,7 @@
         portlet.setState("Normal");
         portlet.setLayoutRow(22);
         portlet.setLayoutColumn(11);
-        SecurityConstraints fragmentConstraints = pageManager.newSecurityConstraints();
+        SecurityConstraints fragmentConstraints = portlet.newSecurityConstraints();
         fragmentConstraints.setOwner("user");
         portlet.setSecurityConstraints(fragmentConstraints);
         root.getFragments().add(portlet);
@@ -262,20 +262,20 @@
         SecurityConstraintsDef constraintsDef = pageManager.newSecurityConstraintsDef();
         constraintsDef.setName("public-view");
         List defConstraints = new ArrayList(1);
-        SecurityConstraint defConstraint = pageManager.newSecurityConstraint();
+        SecurityConstraint defConstraint = pageSecurity.newSecurityConstraint();
         defConstraint.setUsers(Shared.makeListFromCSV("*"));
         defConstraint.setPermissions(Shared.makeListFromCSV("view"));
         defConstraints.add(defConstraint);
         constraintsDef.setSecurityConstraints(defConstraints);
         constraintsDefs.add(constraintsDef);
-        constraintsDef = pageManager.newSecurityConstraintsDef();
+        constraintsDef = pageSecurity.newSecurityConstraintsDef();
         constraintsDef.setName("admin-all");
         defConstraints = new ArrayList(2);
-        defConstraint = pageManager.newSecurityConstraint();
+        defConstraint = pageSecurity.newSecurityConstraint();
         defConstraint.setRoles(Shared.makeListFromCSV("admin"));
         defConstraint.setPermissions(Shared.makeListFromCSV("view,edit"));
         defConstraints.add(defConstraint);
-        defConstraint = pageManager.newSecurityConstraint();
+        defConstraint = pageSecurity.newSecurityConstraint();
         defConstraint.setRoles(Shared.makeListFromCSV("nobody"));
         defConstraints.add(defConstraint);
         constraintsDef.setSecurityConstraints(defConstraints);
@@ -556,7 +556,7 @@
         page.setTitle("UPDATED");
         page.getRootFragment().getProperties().remove("custom-prop1");
         page.getRootFragment().getProperties().put("UPDATED", "UPDATED");
-        SecurityConstraint pageConstraint = pageManager.newSecurityConstraint();
+        SecurityConstraint pageConstraint = page.newSecurityConstraint();
         pageConstraint.setUsers(Shared.makeListFromCSV("UPDATED"));
         page.getSecurityConstraints().getSecurityConstraints().add(0, pageConstraint);
         pageManager.updatePage(page);

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=350178&r1=350177&r2=350178&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
Wed Nov 30 21:49:56 2005
@@ -20,6 +20,7 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.jetspeed.om.common.SecurityConstraint;
 import org.apache.jetspeed.om.common.SecurityConstraints;
 import org.apache.jetspeed.om.page.Fragment;
 
@@ -63,6 +64,22 @@
      */
     public void setSecurityConstraints(SecurityConstraints constraints)
     {
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraints()
+     */
+    public SecurityConstraints newSecurityConstraints()
+    {
+        return null;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraint()
+     */
+    public SecurityConstraint newSecurityConstraint()
+    {
+        return null;
     }
     
     /* (non-Javadoc)

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/common/SecuredResource.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/common/SecuredResource.java?rev=350178&r1=350177&r2=350178&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/common/SecuredResource.java
(original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/common/SecuredResource.java
Wed Nov 30 21:49:56 2005
@@ -63,6 +63,24 @@
 
     /**
      * <p>
+     * newSecurityConstraints
+     * </p>
+     *
+     * @return a newly created SecurityConstraints object
+     */
+    SecurityConstraints newSecurityConstraints();
+
+    /**
+     * <p>
+     * newSecurityConstraint
+     * </p>
+     *
+     * @return a newly created SecurityConstraint object
+     */
+    SecurityConstraint newSecurityConstraint();
+
+    /**
+     * <p>
      * checkConstraints
      * </p>
      *

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/page/PageSecurity.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/page/PageSecurity.java?rev=350178&r1=350177&r2=350178&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/page/PageSecurity.java
(original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/page/PageSecurity.java
Wed Nov 30 21:49:56 2005
@@ -53,6 +53,15 @@
 
     /**
      * <p>
+     * newSecurityConstraintsDef
+     * </p>
+     *
+     * @return a newly created SecurityConstraintsDef object
+     */
+    SecurityConstraintsDef newSecurityConstraintsDef();
+
+    /**
+     * <p>
      * getSecurityConstraintsDef
      * </p>
      *



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