directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 22303 - in incubator/directory/eve/branches/start/src/java/org/apache/eve: backend/jdbm protocol
Date Wed, 30 Jun 2004 03:39:24 GMT
Author: akarasulu
Date: Tue Jun 29 20:39:23 2004
New Revision: 22303

Removed:
   incubator/directory/eve/branches/start/src/java/org/apache/eve/protocol/SearchRequestProcessor.java
Modified:
   incubator/directory/eve/branches/start/src/java/org/apache/eve/backend/jdbm/JdbmDatabase.java
   incubator/directory/eve/branches/start/src/java/org/apache/eve/backend/jdbm/JdbmModule.java
   incubator/directory/eve/branches/start/src/java/org/apache/eve/backend/jdbm/LdapEntryImpl.java
   incubator/directory/eve/branches/start/src/java/org/apache/eve/protocol/ModifyDnHandler.java
   incubator/directory/eve/branches/start/src/java/org/apache/eve/protocol/SearchHandler.java
Log:
Commit changes ...

 o fixed bug where modDn changes to children were not being made correctly
 o also fixed bug where cached objects were getting stale; I'm sure there's more
 o removing the search request processor which is old news
 


Modified: incubator/directory/eve/branches/start/src/java/org/apache/eve/backend/jdbm/JdbmDatabase.java
==============================================================================
--- incubator/directory/eve/branches/start/src/java/org/apache/eve/backend/jdbm/JdbmDatabase.java
(original)
+++ incubator/directory/eve/branches/start/src/java/org/apache/eve/backend/jdbm/JdbmDatabase.java
Tue Jun 29 20:39:23 2004
@@ -43,6 +43,7 @@
 
 import org.apache.commons.collections.MultiMap ;
 import org.apache.commons.collections.MultiHashMap ;
+import org.apache.commons.collections.LRUMap;
 
 import org.apache.ldap.common.name.DnParser ;
 import org.apache.ldap.common.util.NamespaceTools ;
@@ -74,19 +75,19 @@
     private final Map m_indices ;
 
     private NameParser m_nonNormalizingParser = null ;
-    private final NameParser m_parser ;
+    private final LRUMap byIdCache ;
 
 
     public JdbmDatabase(final Schema a_schema,
         final Name a_suffix,
-        final String a_wkdirPath)
+        final String a_wkdirPath, LRUMap byIdCache )
         throws BackendException, NamingException
     {
+        this.byIdCache = byIdCache ;
         m_schema = a_schema ;
         m_suffix = a_suffix ;
         m_wkdir = a_wkdirPath ;
 
-        m_parser = m_schema.getNormalizingParser() ;
         try {
             m_nonNormalizingParser = new DnParser() ;
         } catch(IOException e) {
@@ -312,6 +313,11 @@
     public LdapEntryImpl read(BigInteger a_id)
         throws BackendException, NamingException
     {
+        if (byIdCache.containsKey(a_id))
+        {
+            return (LdapEntryImpl) byIdCache.get(a_id);
+        }
+
         LdapEntryImpl l_entry = new LdapEntryImpl(this.m_schema) ;
         l_entry.enableLogging(getLogger()) ;
 
@@ -914,7 +920,7 @@
 	    }
 
         l_name.remove( l_name.size() - 1 ) ;
-	    l_name.add( l_name.size(), a_newRdn ) ;
+	    l_name.add( a_newRdn ) ;
 	    an_entry.addValue( l_attribute, l_value ) ;
 
         if( getLogger().isDebugEnabled() ) 
@@ -943,7 +949,7 @@
 	    Cursor l_children ;
 	    Name l_childDN ;
 
-        if ( getLogger().isDebugEnabled() ) 
+        if ( getLogger().isDebugEnabled() )
         {
             getLogger().debug( "" //ProtocolModule.getMessageKey()
                 + " - Database.modifyDn() - called on entry '"
@@ -973,8 +979,7 @@
 
             // Add to the copy of the parent the unnormalized rdn of the child
             // Dn to get the new Dn of the child entry - call recursively.
-	        l_childDN.add( 0,
-                NamespaceTools.getRdn( l_child.getEntryDN() ) ) ;
+	        l_childDN.add( NamespaceTools.getRdn( l_child.getEntryDN() ) ) ;
             modifyDn( l_child, l_childDN ) ;
 	    }
     }

Modified: incubator/directory/eve/branches/start/src/java/org/apache/eve/backend/jdbm/JdbmModule.java
==============================================================================
--- incubator/directory/eve/branches/start/src/java/org/apache/eve/backend/jdbm/JdbmModule.java
(original)
+++ incubator/directory/eve/branches/start/src/java/org/apache/eve/backend/jdbm/JdbmModule.java
Tue Jun 29 20:39:23 2004
@@ -552,7 +552,7 @@
             m_byIdCache.setMaximumSize(m_cache.getMaximumSize()) ;
             m_searchEngine = new SearchEngine() ;
             m_searchEngine.enableLogging(getLogger()) ;
-            m_db = new JdbmDatabase (m_schema, m_suffix, m_wkdirPath) ;
+            m_db = new JdbmDatabase (m_schema, m_suffix, m_wkdirPath, this.m_byIdCache) ;
 	        m_db.enableLogging(getLogger()) ;
 
             Configuration [] l_indices =

Modified: incubator/directory/eve/branches/start/src/java/org/apache/eve/backend/jdbm/LdapEntryImpl.java
==============================================================================
--- incubator/directory/eve/branches/start/src/java/org/apache/eve/backend/jdbm/LdapEntryImpl.java
(original)
+++ incubator/directory/eve/branches/start/src/java/org/apache/eve/backend/jdbm/LdapEntryImpl.java
Tue Jun 29 20:39:23 2004
@@ -21,20 +21,16 @@
 import javax.naming.NamingException ;
 import javax.naming.directory.AttributeInUseException ;
 import javax.naming.directory.InvalidAttributeValueException ;
-import javax.naming.directory.AttributeModificationException ;
 import javax.naming.directory.InvalidAttributeIdentifierException ;
 
-import org.apache.ldap.common.util.NamespaceTools ;
 import org.apache.eve.backend.LdapEntry ;
 import org.apache.eve.schema.Schema ;
-import org.apache.eve.protocol.ProtocolModule;
 
 import org.apache.avalon.framework.logger.Logger ;
 import org.apache.avalon.framework.logger.LogEnabled ;
 
 import org.apache.commons.collections.LRUMap ;
 import org.apache.commons.collections.MultiHashMap ;
-import org.apache.ldap.common.name.DnParser;
 
 
 /**
@@ -336,7 +332,7 @@
     /**
      * Gets a multivalued attribute by name.
      *
-     * @param a_attribName the name of the attribute to lookup.
+     * @param an_attribName the name of the attribute to lookup.
      * @return a Collection or null if no attribute value exists.
      */
     public Collection getMultiValue(String an_attribName)
@@ -349,7 +345,7 @@
      * Gets a single valued attribute by name or returns the first value of a
      * multivalued attribute.
      *
-     * @param a_attribName the name of the attribute to lookup.
+     * @param an_attribName the name of the attribute to lookup.
      * @return an Object value which is either a String or byte [] or null if
      * the attribute does not exist.
      */
@@ -474,7 +470,7 @@
      *
      * @param an_attribName attribute name/key
      * @param a_value the value to remove
-     * @throws AttributeModificationException when an attempt is made to modify
+     * @throws InvalidAttributeIdentifierException when an attempt is made to modify
      * an attribute, its identifier, or its values that conflicts with the
      * attribute's (schema) definition or the attribute's state.  Also thrown
      * if the specified attribute name does not exist as a key in this Entry.
@@ -509,8 +505,7 @@
      * attribute.
      *
      * @param an_attribName attribute name/key
-     * @param a_value the value to remove
-     * @throws AttributeModificationException when an attempt is made to modify
+     * @throws InvalidAttributeIdentifierException when an attempt is made to modify
      * an attribute, its identifier, or its values that conflicts with the
      * attribute's (schema) definition or the attribute's state.  Also thrown
      * if the specified attribute name does not exist as a key in this Entry.
@@ -546,7 +541,7 @@
      *
      * @param an_attribName attribute name/key
      * @param a_valueArray the set of values to remove
-     * @throws AttributeModificationException when an attempt is made to modify
+     * @throws InvalidAttributeIdentifierException when an attempt is made to modify
      * an attribute, its identifier, or its values that conflicts with the
      * attribute's (schema) definition or the attribute's state.  Also thrown
      * if the specified attribute name does not exist as a key in this Entry.
@@ -644,20 +639,29 @@
         // Get the old user provided Dn and remove it by removing it from
         // this MultiMap and adding it to the m_removed MultiMap.
         String l_oldDn = getEntryDN() ;
+        String oldParentDn = getParentDN();
+        Name newParentDn = (Name) a_dn.clone();
+        newParentDn.remove(newParentDn.size()-1);
         remove(DN_ATTR, l_oldDn) ;
+        remove(PARENTDN_ATTR, oldParentDn);
         if(m_isValid) {
             m_removed.put(DN_ATTR, l_oldDn) ;
+            m_removed.put(PARENTDN_ATTR, oldParentDn);
         }
 
         // Reparse as normalized name using schema's normalizing parser
 		m_normalizedDn =
             m_schema.getNormalizingParser().parse(a_dn.toString()) ;
+        Name normParentDn = (Name) m_normalizedDn.clone();
+        normParentDn.remove(normParentDn.size()-1);
 
         // Add unnormalized user provided Dn argument to this MultiMap and
         // the m_added MultiMap
         put(DN_ATTR, a_dn.toString()) ;
+        put(PARENTDN_ATTR, normParentDn.toString());
         if(this.m_isValid) {
             m_added.put(DN_ATTR, a_dn.toString()) ;
+            m_added.put(PARENTDN_ATTR, normParentDn.toString());
         }
 
         if(getLogger().isDebugEnabled()) {

Modified: incubator/directory/eve/branches/start/src/java/org/apache/eve/protocol/ModifyDnHandler.java
==============================================================================
--- incubator/directory/eve/branches/start/src/java/org/apache/eve/protocol/ModifyDnHandler.java
(original)
+++ incubator/directory/eve/branches/start/src/java/org/apache/eve/protocol/ModifyDnHandler.java
Tue Jun 29 20:39:23 2004
@@ -10,15 +10,13 @@
 package org.apache.eve.protocol ;
 
 
-import org.apache.ldap.common.NotImplementedException ;
-import org.apache.ldap.common.name.LdapName;
 import org.apache.ldap.common.message.*;
+import org.apache.ldap.common.name.LdapName;
 import org.apache.avalon.framework.CascadingRuntimeException;
-import org.apache.eve.jndi.UnifiedLdapContext;
 
+import javax.naming.Name;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
-import javax.naming.Name;
 import javax.naming.ldap.LdapContext;
 
 

Modified: incubator/directory/eve/branches/start/src/java/org/apache/eve/protocol/SearchHandler.java
==============================================================================
--- incubator/directory/eve/branches/start/src/java/org/apache/eve/protocol/SearchHandler.java
(original)
+++ incubator/directory/eve/branches/start/src/java/org/apache/eve/protocol/SearchHandler.java
Tue Jun 29 20:39:23 2004
@@ -13,11 +13,9 @@
 
 import java.util.Iterator ;
 import java.util.HashSet;
-import java.util.Collections;
 
 import java.io.IOException ;
 import java.io.ByteArrayInputStream ;
-import java.rmi.Naming;
 
 import javax.naming.Name ;
 import javax.naming.NamingException;

Mime
View raw message