directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r894778 - /directory/apacheds/branches/apacheds-schema/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
Date Thu, 31 Dec 2009 04:03:53 GMT
Author: kayyagari
Date: Thu Dec 31 04:03:53 2009
New Revision: 894778

URL: http://svn.apache.org/viewvc?rev=894778&view=rev
Log:
modified the way ApplyLdif data is parsed

Modified:
    directory/apacheds/branches/apacheds-schema/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java

Modified: directory/apacheds/branches/apacheds-schema/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java?rev=894778&r1=894777&r2=894778&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
Thu Dec 31 04:03:53 2009
@@ -300,10 +300,37 @@
         {
             String[] ldifs = applyLdifs.value();
 
-            for ( String s : ldifs )
+            String DN_START = "dn:";
+            
+            StringBuilder sb = new StringBuilder();
+
+            for ( int i=0; i< ldifs.length; )
             {
-                LOG.debug( "Applying {} to {}", ldifs, desc.getDisplayName() );
-                injectEntries( service, s );
+                String s = ldifs[i++].trim();
+                if( s.startsWith( DN_START ) )
+                {
+                    sb.append( s ).append( '\n' );
+
+                    // read the rest of lines till we encounter DN again
+                    while( i < ldifs.length )
+                    {
+                        s = ldifs[i++];
+                        if( !s.startsWith( DN_START ) )
+                        {
+                            sb.append( s ).append( '\n' );
+                        }
+                        else
+                        {
+                            break;
+                        }
+                    }
+                    
+                    LOG.debug( "Applying {} to {}", sb, desc.getDisplayName() );
+                    injectEntries( service, sb.toString() );
+                    sb.setLength( 0 );
+                    
+                    i--; // step up a line
+                }
             }
         }
     }



Mime
View raw message