You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by at...@apache.org on 2008/09/18 10:39:13 UTC

svn commit: r696599 - in /portals/jetspeed-2/portal/branches/security-refactoring: components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/ components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/ jetspeed-...

Author: ate
Date: Thu Sep 18 01:39:12 2008
New Revision: 696599

URL: http://svn.apache.org/viewvc?rev=696599&view=rev
Log:
- fixing incorrectly spelled HierarchyType
- adding support for HierarchyAssociationType in the JetspeedPrincipalAssociationHandler
- providing a SimpleHierarchyPrincipalAssociationHandler implementation

Added:
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/SimpleHierarchyPrincipalAssociationHandler.java   (with props)
Modified:
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/JetspeedPrincipalHierarchyAssocationTypeImpl.java
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/BaseJetspeedPrincipalAssociationHandler.java
    portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalAssociationHandler.java
    portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalHierachyAssocationType.java

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java?rev=696599&r1=696598&r2=696599&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java Thu Sep 18 01:39:12 2008
@@ -230,7 +230,7 @@
                 resolved.add(p.getId());
             }
             List<Long> ids = new ArrayList<Long>(resolved);
-            if (this.hierachyAssType.getHierachyType().equals(JetspeedPrincipalHierachyAssocationType.HierachyType.PART_OF))
+            if (this.hierachyAssType.getHierachyType().equals(JetspeedPrincipalHierachyAssocationType.HierarchyType.PART_OF))
             {
                 for (Long id : ids)
                 {

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/JetspeedPrincipalHierarchyAssocationTypeImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/JetspeedPrincipalHierarchyAssocationTypeImpl.java?rev=696599&r1=696598&r2=696599&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/JetspeedPrincipalHierarchyAssocationTypeImpl.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/JetspeedPrincipalHierarchyAssocationTypeImpl.java Thu Sep 18 01:39:12 2008
@@ -24,15 +24,15 @@
  */
 public class JetspeedPrincipalHierarchyAssocationTypeImpl extends JetspeedPrincipalAssociationTypeImpl implements JetspeedPrincipalHierachyAssocationType
 {
-    private HierachyType hierarchyType;
+    private HierarchyType hierarchyType;
     
-    public JetspeedPrincipalHierarchyAssocationTypeImpl(String associationName, JetspeedPrincipalType type, HierachyType hierarchyType, boolean required)
+    public JetspeedPrincipalHierarchyAssocationTypeImpl(String associationName, JetspeedPrincipalType type, HierarchyType hierarchyType, boolean required)
     {
         super(associationName, type, type, required);
         this.hierarchyType = hierarchyType;
     }
 
-    public HierachyType getHierachyType()
+    public HierarchyType getHierachyType()
     {
         return hierarchyType;
     }

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/BaseJetspeedPrincipalAssociationHandler.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/BaseJetspeedPrincipalAssociationHandler.java?rev=696599&r1=696598&r2=696599&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/BaseJetspeedPrincipalAssociationHandler.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/BaseJetspeedPrincipalAssociationHandler.java Thu Sep 18 01:39:12 2008
@@ -20,11 +20,13 @@
 import org.apache.jetspeed.security.JetspeedPrincipal;
 import org.apache.jetspeed.security.JetspeedPrincipalAssociationHandler;
 import org.apache.jetspeed.security.JetspeedPrincipalAssociationType;
+import org.apache.jetspeed.security.JetspeedPrincipalHierachyAssocationType;
 import org.apache.jetspeed.security.JetspeedPrincipalManager;
 import org.apache.jetspeed.security.PrincipalAssociationNotAllowedException;
 import org.apache.jetspeed.security.PrincipalAssociationRequiredException;
 import org.apache.jetspeed.security.PrincipalAssociationUnsupportedException;
 import org.apache.jetspeed.security.PrincipalNotFoundException;
+import org.apache.jetspeed.security.JetspeedPrincipalHierachyAssocationType.HierarchyType;
 import org.apache.jetspeed.security.spi.JetspeedPrincipalAssociationStorageManager;
 import org.apache.jetspeed.security.spi.JetspeedPrincipalManagerSPI;
 
@@ -57,21 +59,22 @@
             to.addAssociationHandler(this);
         }
     }
-
-    public void add(JetspeedPrincipal from, JetspeedPrincipal to) throws PrincipalNotFoundException,
-                                                                 PrincipalAssociationNotAllowedException, PrincipalAssociationUnsupportedException
-    {
-        if (from.getType().equals(associationType.getFromPrincipalType()) && to.getType().equals(associationType.getToPrincipalType()))
-        {
-            jpasm.addAssociation(from, to, associationType.getAssociationName());
-        }
-    }
-
+    
     public JetspeedPrincipalAssociationType getAssociationType()
     {
         return associationType;
     }
     
+    public boolean isHierachyAssociationType()
+    {
+        return associationType instanceof JetspeedPrincipalHierachyAssocationType;
+    }
+
+    public HierarchyType getHierarchyType()
+    {
+        return isHierachyAssociationType() ? ((JetspeedPrincipalHierachyAssocationType)associationType).getHierachyType() : null;
+    }
+
     public JetspeedPrincipalManager getManagerFrom()
     {
         return from;
@@ -81,6 +84,15 @@
     {
         return to;
     }
+    
+    public void add(JetspeedPrincipal from, JetspeedPrincipal to) throws PrincipalNotFoundException,
+                                                                 PrincipalAssociationNotAllowedException, PrincipalAssociationUnsupportedException
+    {
+        if (from.getType().equals(associationType.getFromPrincipalType()) && to.getType().equals(associationType.getToPrincipalType()))
+        {
+            jpasm.addAssociation(from, to, associationType.getAssociationName());
+        }
+    }
 
     public void remove(JetspeedPrincipal from, JetspeedPrincipal to) throws PrincipalAssociationRequiredException, PrincipalNotFoundException
     {

Added: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/SimpleHierarchyPrincipalAssociationHandler.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/SimpleHierarchyPrincipalAssociationHandler.java?rev=696599&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/SimpleHierarchyPrincipalAssociationHandler.java (added)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/SimpleHierarchyPrincipalAssociationHandler.java Thu Sep 18 01:39:12 2008
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jetspeed.security.spi.impl;
+
+import org.apache.jetspeed.security.DependentPrincipalException;
+import org.apache.jetspeed.security.JetspeedPrincipal;
+import org.apache.jetspeed.security.JetspeedPrincipalHierachyAssocationType;
+import org.apache.jetspeed.security.PrincipalNotRemovableException;
+import org.apache.jetspeed.security.impl.JetspeedPrincipalHierarchyAssocationTypeImpl;
+import org.apache.jetspeed.security.spi.JetspeedPrincipalAssociationStorageManager;
+import org.apache.jetspeed.security.spi.JetspeedPrincipalManagerSPI;
+import org.apache.jetspeed.security.JetspeedPrincipalHierachyAssocationType.HierarchyType;
+
+/**
+ * @version $Id$
+ *
+ */
+public class SimpleHierarchyPrincipalAssociationHandler extends BaseJetspeedPrincipalAssociationHandler
+{
+
+    public SimpleHierarchyPrincipalAssociationHandler(JetspeedPrincipalHierachyAssocationType associationType,
+                                                       JetspeedPrincipalManagerSPI manager,
+                                                       JetspeedPrincipalAssociationStorageManager jpasm)
+    {
+        super(associationType, manager, manager, jpasm);
+    }
+
+    public SimpleHierarchyPrincipalAssociationHandler(String associationName, JetspeedPrincipalManagerSPI manager,
+                                                       HierarchyType hierarchyType, boolean required,
+                                                       JetspeedPrincipalAssociationStorageManager jpasm)
+    {
+        this(new JetspeedPrincipalHierarchyAssocationTypeImpl(associationName, manager.getPrincipalType(), hierarchyType, required), manager, jpasm);
+    }
+
+    public void beforeRemoveFrom(JetspeedPrincipal from) throws PrincipalNotRemovableException,
+                                                        DependentPrincipalException
+    {
+    }
+
+    public void beforeRemoveTo(JetspeedPrincipal to) throws PrincipalNotRemovableException, DependentPrincipalException
+    {
+    }
+}

Propchange: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/SimpleHierarchyPrincipalAssociationHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/SimpleHierarchyPrincipalAssociationHandler.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/SimpleHierarchyPrincipalAssociationHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalAssociationHandler.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalAssociationHandler.java?rev=696599&r1=696598&r2=696599&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalAssociationHandler.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalAssociationHandler.java Thu Sep 18 01:39:12 2008
@@ -16,12 +16,17 @@
  */
 package org.apache.jetspeed.security;
 
+import org.apache.jetspeed.security.JetspeedPrincipalHierachyAssocationType.HierarchyType;
+
 /**
  * @version $Id$
  */
 public interface JetspeedPrincipalAssociationHandler
 {
     JetspeedPrincipalAssociationType getAssociationType();
+    boolean isHierachyAssociationType();
+    HierarchyType getHierarchyType();
+    
     JetspeedPrincipalManager getManagerFrom();
     JetspeedPrincipalManager getManagerTo();
 

Modified: portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalHierachyAssocationType.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalHierachyAssocationType.java?rev=696599&r1=696598&r2=696599&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalHierachyAssocationType.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalHierachyAssocationType.java Thu Sep 18 01:39:12 2008
@@ -23,7 +23,7 @@
  */
 public interface JetspeedPrincipalHierachyAssocationType extends JetspeedPrincipalAssociationType
 {
-    enum HierachyType { CHILD_OF, IS_A, PART_OF };
+    enum HierarchyType { CHILD_OF, IS_A, PART_OF };
     
-    HierachyType getHierachyType();
+    HierarchyType getHierachyType();
 }



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