directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r541140 - in /directory/apacheds/branches/apacheds-sasl-branch: core/src/main/java/org/apache/directory/server/core/jndi/ core/src/main/java/org/apache/directory/server/core/partition/ src/site/ src/site/resources/docs/developers/ src/site/...
Date Thu, 24 May 2007 02:35:42 GMT
Author: erodriguez
Date: Wed May 23 19:35:40 2007
New Revision: 541140

URL: http://svn.apache.org/viewvc?view=rev&rev=541140
Log:
Merged revisions r540837:541139 from ApacheDS trunk to SASL branch.

Added:
    directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartitionStructure.java
      - copied unchanged from r541139, directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartitionStructure.java
    directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/PartitionContainer.java
      - copied unchanged from r541139, directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionContainer.java
    directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/PartitionHandler.java
      - copied unchanged from r541139, directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionHandler.java
    directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/PartitionStructure.java
      - copied unchanged from r541139, directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionStructure.java
Removed:
    directory/apacheds/branches/apacheds-sasl-branch/src/site/resources/docs/developers/alias-dereferencing.pdf
    directory/apacheds/branches/apacheds-sasl-branch/src/site/resources/docs/developers/alias-dereferencing.sxw
    directory/apacheds/branches/apacheds-sasl-branch/src/site/resources/docs/users/enablesearchforallusers.ldif
    directory/apacheds/branches/apacheds-sasl-branch/src/site/resources/images/50k-ft-architecture.png
    directory/apacheds/branches/apacheds-sasl-branch/src/site/resources/images/apache-directory-logo.png
    directory/apacheds/branches/apacheds-sasl-branch/src/site/resources/images/asf_logo_wide.gif
    directory/apacheds/branches/apacheds-sasl-branch/src/site/resources/images/icon.png
    directory/apacheds/branches/apacheds-sasl-branch/src/site/sandbox/drafts/draft-ietf-ldapext-acl-model-08.txt
    directory/apacheds/branches/apacheds-sasl-branch/src/site/sandbox/rfcs/rfc3642.txt.pdf
    directory/apacheds/branches/apacheds-sasl-branch/src/site/sandbox/rfcs/rfc3698.txt.pdf
    directory/apacheds/branches/apacheds-sasl-branch/src/site/site.xml
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/docs/developers/aci_aciitemabnf.xml
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/docs/developers/aci_aciitemasn1.xml
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/docs/developers/aci_implnotes.xml
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/docs/developers/aci_notesfromx501
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/docs/developers/architecture.xml
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/docs/developers/backend.xml
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/docs/developers/components.xml
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/docs/developers/index.xml
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/docs/developers/interceptor_interactions.xml
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/docs/developers/interceptor_mechanism.xml
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/docs/developers/networking.xml
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/docs/developers/partitions.xml
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/docs/developers/protocol.xml
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/docs/developers/xldbm.pdf
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/docs/users/acareas.xml
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/docs/users/allowselfpasswordmodify
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/docs/users/authentication.xml
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/docs/users/building.xml
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/docs/users/enablesearchforallusers.xml
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/docs/users/newuser.ldif
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/docs/users/subentries.xml
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/docs/users/subtreespecificationgrammar.xml
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/docs/users/userclasses.xml
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/features.xml
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/index.xml
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/modules.xml
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/notices.xml
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/releases.xml
    directory/apacheds/branches/apacheds-sasl-branch/src/site/xdoc/roadmap.xml
Modified:
    directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java
    directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java

Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java?view=diff&rev=541140&r1=541139&r2=541140
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java
(original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java
Wed May 23 19:35:40 2007
@@ -184,9 +184,18 @@
      */
     public void ldapUnbind() throws NamingException
     {
-        String bindDn = ( String ) getEnvironment().get( Context.SECURITY_PRINCIPAL );
+        Object dn = getEnvironment().get( Context.SECURITY_PRINCIPAL );;
         
-        super.getNexusProxy().unbind( new UnbindOperationContext( new LdapDN( bindDn ) )
);
+        if ( dn instanceof LdapDN )
+        {
+            super.getNexusProxy().unbind( new UnbindOperationContext( ( LdapDN ) dn ) );
+        }
+        else
+        {
+            String bindDn = ( String ) dn;
+            
+            super.getNexusProxy().unbind( new UnbindOperationContext( new LdapDN( bindDn
) ) );
+        }
     }
 
 

Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?view=diff&rev=541140&r1=541139&r2=541140
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
(original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
Wed May 23 19:35:40 2007
@@ -74,7 +74,6 @@
 import org.apache.directory.shared.ldap.message.SubentriesControl;
 import org.apache.directory.shared.ldap.message.extended.NoticeOfDisconnect;
 import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.Normalizer;
 import org.apache.directory.shared.ldap.schema.UsageEnum;
@@ -124,99 +123,9 @@
     /** the backends keyed by normalized suffix strings */
     private Map<String, Partition> partitions = new HashMap<String, Partition>();
     
+    /** A structure to hold all the partitions */
     private PartitionStructure partitionList = new PartitionContainer();
     
-    private interface PartitionStructure
-    {
-        boolean isPartition();
-        public PartitionStructure addPartitionHandler( String name, PartitionStructure children
);
-    }
-    
-    private class PartitionContainer implements PartitionStructure
-    {
-        private Map<String, PartitionStructure> children;
-        
-        private PartitionContainer()
-        {
-            children = new HashMap<String, PartitionStructure>();
-        }
-        
-        public boolean isPartition()
-        {
-            return false;
-        }
-        
-        public PartitionStructure addPartitionHandler( String name, PartitionStructure child
)
-        {
-            children.put( name, child );
-            return this;
-        }
-        
-        public String toString()
-        {
-            StringBuilder sb = new StringBuilder();
-            
-            sb.append( "Partition container :\n" );
-            
-            for ( PartitionStructure child:children.values() )
-            {
-                sb.append( '{' ).append( child.toString() ).append( "} " );
-            }
-            
-            return sb.toString();
-        }
-    }
-    
-    private class PartitionHandler implements PartitionStructure
-    {
-        private Partition partition;
-        
-        private PartitionHandler( Partition partition )
-        {
-            this.partition = partition;
-        }
-
-        public boolean isPartition()
-        {
-            return true;
-        }
-
-        public PartitionStructure addPartitionHandler( String name, PartitionStructure partition
)
-        {
-            return this;
-        }
-        
-        public Partition getpartition()
-        {
-            return partition;
-        }
-
-        public String toString()
-        {
-            try
-            {
-                return partition.getSuffix().getUpName();
-            }
-            catch ( NamingException ne )
-            {
-                return "Unkown partition";
-            }
-        }
-}
-    
-    private PartitionStructure buildPartitionStructure( PartitionStructure current, LdapDN
dn, int index, Partition partition )
-    {
-        if ( index == dn.size() - 1 )
-        {
-            return current.addPartitionHandler( dn.getRdn( index ).toString(), new PartitionHandler(
partition ) );
-        }
-        else
-        {
-            return current.addPartitionHandler( dn.getRdn( index ).toString(), 
-                buildPartitionStructure( new PartitionContainer(), dn, index + 1, partition
) );
-        }
-    }
-
     /** the read only rootDSE attributes */
     private final Attributes rootDSE;
 
@@ -487,12 +396,15 @@
             throw new ConfigurationException( "Duplicate partition suffix: " + key );
         }
         
-        partitions.put( key, system );
+        synchronized ( partitionList )
+        {
+            partitions.put( key, system );
         
-        buildPartitionStructure( partitionList, system.getSuffix(), 0, system );
+            partitionList.buildPartitionStructure( partitionList, system.getSuffix(), 0,
system );
 
-        Attribute namingContexts = rootDSE.get( NAMINGCTXS_ATTR );
-        namingContexts.add( system.getUpSuffix().getUpName() );
+            Attribute namingContexts = rootDSE.get( NAMINGCTXS_ATTR );
+            namingContexts.add( system.getUpSuffix().getUpName() );
+        }
 
         return systemCfg;
     }
@@ -662,12 +574,15 @@
             partition.init( factoryCfg, config );
         }
         
-        partitions.put( partition.getSuffix().toString(), partition );
-        
-        buildPartitionStructure( partitionList, partition.getSuffix(), 0, partition );
+        synchronized ( partitionList )
+        {
+            partitions.put( partition.getSuffix().toString(), partition );
+            
+            partitionList.buildPartitionStructure( partitionList, partition.getSuffix(),
0, partition );
 
-        Attribute namingContexts = rootDSE.get( NAMINGCTXS_ATTR );
-        namingContexts.add( partition.getUpSuffix().getUpName() );
+            Attribute namingContexts = rootDSE.get( NAMINGCTXS_ATTR );
+            namingContexts.add( partition.getUpSuffix().getUpName() );
+        }
     }
 
 
@@ -683,10 +598,25 @@
 
         Attribute namingContexts = rootDSE.get( NAMINGCTXS_ATTR );
         namingContexts.remove( partition.getUpSuffix().getUpName() );
-        partitions.remove( key );
 
-        partition.sync();
-        partition.destroy();
+        // Create a new partition list. 
+        // This is easier to create a new structure from scratch than to reorganize
+        // the current structure. As this strcuture is not modified often
+        // this is an acceptable solution.
+        synchronized (partitionList)
+        {
+            partitions.remove( key );
+        
+            partitionList = new PartitionContainer();
+            
+            for ( Partition part:partitions.values() )
+            {
+                partitionList.buildPartitionStructure( partitionList, part.getSuffix(), 0,
partition );
+            }
+    
+            partition.sync();
+            partition.destroy();
+        }
     }
 
 
@@ -835,19 +765,6 @@
 
 
     /**
-<<<<<<< .mine
-=======
-     * @see Partition#modify(org.apache.directory.shared.ldap.name.LdapDN,javax.naming.directory.ModificationItem[])
-     */
-    /*public void modify( LdapDN dn, ModificationItemImpl[] mods ) throws NamingException
-    {
-        Partition backend = getBackend( dn );
-        backend.modify( dn, mods );
-    }*/
-
-
-    /**
->>>>>>> .r530934
      * @see Partition#list(org.apache.directory.shared.ldap.name.LdapDN)
      */
     public NamingEnumeration list( OperationContext opContext ) throws NamingException
@@ -1116,16 +1033,32 @@
      */
     private Partition getBackend( LdapDN dn ) throws NamingException
     {
-        LdapDN clonedDn = ( LdapDN ) dn.clone();
+        Enumeration<String> rdns = dn.getAll();
+        PartitionStructure currentPartition = partitionList;
         
-        while ( clonedDn.size() > 0 )
+        // This is synchronized so that we can't read the
+        // partitionList when it is modified.
+        synchronized ( partitionList )
         {
-            if ( partitions.containsKey( clonedDn.toString() ) )
+            // Iterate through all the RDN until we find the associated partition
+            while ( rdns.hasMoreElements() )
             {
-                return partitions.get( clonedDn.toString() );
+                String rdn = rdns.nextElement();
+                
+                if ( currentPartition.contains( rdn ) )
+                {
+                    currentPartition = currentPartition.getPartition( rdn );
+    
+                    if ( currentPartition.isPartition() )
+                    {
+                        return currentPartition.getPartition();
+                    }
+                }
+                else
+                {
+                    break;
+                }
             }
-
-            clonedDn.remove( clonedDn.size() - 1 );
         }
         
         throw new LdapNameNotFoundException( dn.getUpName() );



Mime
View raw message