directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1051324 - in /directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative: AbstractAdministrativePoint.java AdministrativePoint.java Subentry.java
Date Tue, 21 Dec 2010 00:07:35 GMT
Author: elecharny
Date: Tue Dec 21 00:07:35 2010
New Revision: 1051324

URL: http://svn.apache.org/viewvc?rev=1051324&view=rev
Log:
o Moved the Subentry class in core-api
o Added a set of subentries in the AdministrativePoint class to be able to easily find back
the associated subentries

Added:
    directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/Subentry.java
      - copied, changed from r1051097, directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/subtree/Subentry.java
Modified:
    directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AbstractAdministrativePoint.java
    directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AdministrativePoint.java

Modified: directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AbstractAdministrativePoint.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AbstractAdministrativePoint.java?rev=1051324&r1=1051323&r2=1051324&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AbstractAdministrativePoint.java
(original)
+++ directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AbstractAdministrativePoint.java
Tue Dec 21 00:07:35 2010
@@ -20,7 +20,9 @@
 package org.apache.directory.server.core.administrative;
 
 
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.directory.shared.ldap.name.DN;
@@ -51,6 +53,9 @@ public abstract class AbstractAdministra
 
     /** The children AdministrativePoints */
     protected Map<String, AdministrativePoint> children;
+    
+    /** The associated subentries */
+    private Set<Subentry> subentries; 
 
 
     /**
@@ -63,6 +68,7 @@ public abstract class AbstractAdministra
         this.role = role;
         this.children = new ConcurrentHashMap<String, AdministrativePoint>();
         this.seqNumber = seqNumber;
+        subentries = new HashSet<Subentry>();
     }
 
 
@@ -149,8 +155,54 @@ public abstract class AbstractAdministra
     {
         this.seqNumber = seqNumber;
     }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void addSubentry( Subentry subentry )
+    {
+        synchronized( subentries )
+        {
+            subentries.add( subentry );
+        }
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public Set<Subentry> getSubentries( AdministrativeRole role )
+    {
+        synchronized( subentries )
+        {
+            Set<Subentry> subentries = new HashSet<Subentry>();
+            
+            for ( Subentry subentry : this.subentries )
+            {
+                if ( subentry.getAdministrativeRoles().contains( role ) )
+                {
+                    subentries.add( subentry );
+                }
+            }
+            
+            return subentries;
+        }
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public Set<Subentry> getSubentries()
+    {
+        synchronized( subentries )
+        {
+            return subentries;
+        }
+    }
 
-
+    
     /**
      * {@inheritDoc}
      */

Modified: directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AdministrativePoint.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AdministrativePoint.java?rev=1051324&r1=1051323&r2=1051324&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AdministrativePoint.java
(original)
+++ directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AdministrativePoint.java
Tue Dec 21 00:07:35 2010
@@ -19,6 +19,8 @@
  */
 package org.apache.directory.server.core.administrative;
 
+import java.util.Set;
+
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.subtree.AdministrativeRole;
 
@@ -96,4 +98,28 @@ public interface AdministrativePoint
      * @return The administrativeRole
      */
     AdministrativeRole getRole();
+    
+    
+    /**
+     * Associate a new SubEntry to this AdministrationPoint
+     * 
+     * @param subentry The added SubEntry
+     */
+    void addSubentry( Subentry subentry );
+    
+    
+    /**
+     * Get the set of subentries associated with a role 
+     * @param role The role we are looking the subentries for
+     * @return The Set of subentries found
+     */
+    Set<Subentry> getSubentries( AdministrativeRole role );
+    
+    
+    /**
+     * Get the set of subentries associated with the AdministrativePoint
+     * @param role The role we are looking the subentries for
+     * @return The Set of subentries found
+     */
+    Set<Subentry> getSubentries();
 }

Copied: directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/Subentry.java
(from r1051097, directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/subtree/Subentry.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/Subentry.java?p2=directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/Subentry.java&p1=directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/subtree/Subentry.java&r1=1051097&r2=1051324&rev=1051324&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/subtree/Subentry.java
(original)
+++ directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/Subentry.java
Tue Dec 21 00:07:35 2010
@@ -17,7 +17,7 @@
  *  under the License.
  *
  */
-package org.apache.directory.server.core.subtree;
+package org.apache.directory.server.core.administrative;
 
 
 import java.util.Set;
@@ -47,7 +47,7 @@ public class Subentry
      *
      * @param ss The subtree specification
      */
-    final void setSubtreeSpecification( SubtreeSpecification ss )
+    public void setSubtreeSpecification( SubtreeSpecification ss )
     {
         this.ss = ss;
     }
@@ -56,7 +56,7 @@ public class Subentry
     /**
      * @return The subtree specification
      */
-    final SubtreeSpecification getSubtreeSpecification()
+    public SubtreeSpecification getSubtreeSpecification()
     {
         return ss;
     }
@@ -67,7 +67,7 @@ public class Subentry
      *
      * @param administrativeRoles The roles to be added
      */
-    final void setAdministrativeRoles( Set<AdministrativeRole> administrativeRoles
)
+    public void setAdministrativeRoles( Set<AdministrativeRole> administrativeRoles
)
     {
         this.administrativeRoles = administrativeRoles;
     }
@@ -76,7 +76,7 @@ public class Subentry
     /**
      * @return The list of roles for this subentry
      */
-    final Set<AdministrativeRole> getAdministrativeRoles()
+    public Set<AdministrativeRole> getAdministrativeRoles()
     {
         return administrativeRoles;
     }
@@ -85,7 +85,7 @@ public class Subentry
     /**
      * Tells if the type contains the Collective attribute Administrative Role
      */
-    final boolean isCollectiveAdminRole()
+    public boolean isCollectiveAdminRole()
     {
         return administrativeRoles.contains( AdministrativeRole.CollectiveAttributeInnerArea
) ||
         administrativeRoles.contains( AdministrativeRole.CollectiveAttributeSpecificArea
);
@@ -95,7 +95,7 @@ public class Subentry
     /**
      * Tells if the type contains the SubSchema Administrative Role
      */
-    final boolean isSchemaAdminRole()
+    public boolean isSchemaAdminRole()
     {
         return administrativeRoles.contains( AdministrativeRole.SubSchemaSpecificArea );
     }
@@ -104,7 +104,7 @@ public class Subentry
     /**
      * Tells if the type contains the Access Control Administrative Role
      */
-    final boolean isAccessControlAdminRole()
+    public boolean isAccessControlAdminRole()
     {
         return administrativeRoles.contains( AdministrativeRole.AccessControlSpecificArea
) ||
                administrativeRoles.contains( AdministrativeRole.AccessControlInnerArea );
@@ -114,7 +114,7 @@ public class Subentry
     /**
      * Tells if the type contains the Triggers Administrative Role
      */
-    final boolean isTriggersAdminRole()
+    public boolean isTriggersAdminRole()
     {
         return administrativeRoles.contains( AdministrativeRole.TriggerExecutionSpecificArea
) ||
                administrativeRoles.contains( AdministrativeRole.TriggerExecutionInnerArea
);



Mime
View raw message