You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by er...@apache.org on 2007/01/12 00:41:25 UTC

svn commit: r495442 - /directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeService.java

Author: ersiner
Date: Thu Jan 11 15:41:24 2007
New Revision: 495442

URL: http://svn.apache.org/viewvc?view=rev&rev=495442
Log:
Some clean up on the Coll Attr service.

Modified:
    directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeService.java

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeService.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeService.java?view=diff&rev=495442&r1=495441&r2=495442
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeService.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeService.java Thu Jan 11 15:41:24 2007
@@ -71,6 +71,7 @@
             throws NamingException
         {
             LdapDN name = new LdapDN( result.getName() );
+            name = LdapDN.normalize( name, attrTypeRegistry.getNormalizerMapping() );
             Attributes entry = result.getAttributes();
             String[] retAttrs = controls.getReturningAttributes();
             addCollectiveAttributes( name, entry, retAttrs );
@@ -78,7 +79,7 @@
         }
     };
 
-    private AttributeTypeRegistry registry = null;
+    private AttributeTypeRegistry attrTypeRegistry = null;
     private PartitionNexus nexus = null;
 
 
@@ -86,7 +87,7 @@
     {
         super.init( factoryCfg, cfg );
         nexus = factoryCfg.getPartitionNexus();
-        registry = factoryCfg.getRegistries().getAttributeTypeRegistry();
+        attrTypeRegistry = factoryCfg.getRegistries().getAttributeTypeRegistry();
     }
 
 
@@ -96,20 +97,13 @@
      * attributes that are specified to be excluded via the 'collectiveExclusions'
      * attribute in the entry.
      *
-     * @param name name of the entry being processed
+     * @param normName name of the entry being processed
      * @param entry the entry to have the collective attributes injected
      * @param retAttrs array or attribute type to be specifically included in the result entry(s)
      * @throws NamingException if there are problems accessing subentries
      */
-    private void addCollectiveAttributes( LdapDN name, Attributes entry, String[] retAttrs ) throws NamingException
+    private void addCollectiveAttributes( LdapDN normName, Attributes entry, String[] retAttrs ) throws NamingException
     {
-        LdapDN normName = name;
-        
-        if ( !name.isNormalized() )
-        {
-            normName = LdapDN.normalize( name, registry.getNormalizerMapping() );
-        }
-
         Attributes entryWithCAS = nexus.lookup( normName, new String[] { COLLECTIVE_ATTRIBUTE_SUBENTRIES } );
         Attribute caSubentries = entryWithCAS.get( COLLECTIVE_ATTRIBUTE_SUBENTRIES );
 
@@ -137,7 +131,7 @@
             {
                 /*
                  * This entry does not allow any collective attributes
-                 * to be injected in itself.
+                 * to be injected into itself.
                  */
                 return;
             }
@@ -145,7 +139,7 @@
             exclusions = new HashSet();
             for ( int ii = 0; ii < collectiveExclusions.size(); ii++ )
             {
-                AttributeType attrType = registry.lookup( ( String ) collectiveExclusions.get( ii ) );
+                AttributeType attrType = attrTypeRegistry.lookup( ( String ) collectiveExclusions.get( ii ) );
                 exclusions.add( attrType.getOid() );
             }
         }
@@ -187,7 +181,7 @@
             while ( attrIds.hasMore() )
             {
                 String attrId = ( String ) attrIds.next();
-                AttributeType attrType = registry.lookup( attrId );
+                AttributeType attrType = attrTypeRegistry.lookup( attrId );
 
                 if ( !attrType.isCollective() )
                 {
@@ -297,4 +291,5 @@
      * See: http://issues.apache.org/jira/browse/DIRSERVER-821
      * See: http://issues.apache.org/jira/browse/DIRSERVER-822
      */
+    
 }