directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r981918 - in /directory/apacheds/trunk/core/src: main/java/org/apache/directory/server/core/ test/java/org/apache/directory/server/core/subtree/
Date Tue, 03 Aug 2010 15:12:54 GMT
Author: kayyagari
Date: Tue Aug  3 15:12:54 2010
New Revision: 981918

URL: http://svn.apache.org/viewvc?rev=981918&view=rev
Log:
o added a static schema manager reference to the DNFactory
o updated directory service init() method to set the shema manager in DN factory
o fixed the failing tests

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DNFactory.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DNFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DNFactory.java?rev=981918&r1=981917&r2=981918&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DNFactory.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DNFactory.java
Tue Aug  3 15:12:54 2010
@@ -45,6 +45,8 @@ public class DNFactory
 
     private static final Logger LOG = LoggerFactory.getLogger( DNFactory.class );
 
+    private static SchemaManager schemaManager;
+    
     // stat counters
     private static int hitCount = 0;
     private static int missCount = 0;
@@ -75,13 +77,13 @@ public class DNFactory
         }
 
         DN cachedDN = DN_CACHE.get( dn );
-
+        
         if ( cachedDN == null )
         {
             LOG.debug( "DN {} not found in the cache, creating", dn );
-
+            
             cachedDN = new DN( dn, schemaManager );
-
+            
             DN_CACHE.put( dn, cachedDN );
             missCount++;
         }
@@ -91,11 +93,12 @@ public class DNFactory
             {
                 cachedDN.normalize( schemaManager.getNormalizerMapping() );
             }
-
+            
             hitCount++;
         }
-
+        
         LOG.debug( "DN {} found in the cache", dn );
+//        System.out.println( "DN '" + cachedDN + "' found in the cache and isNormalized
" + cachedDN.isNormalized() );
 //        System.out.println( "DN cache hit - " + hitCount + ", miss - " + missCount + "
and is normalized = "
 //            + cachedDN.isNormalized() );
         return cachedDN;
@@ -104,7 +107,7 @@ public class DNFactory
 
     public static DN create( String... upRdns ) throws LdapInvalidDnException
     {
-        return create( null, upRdns );
+        return create( schemaManager, upRdns );
     }
 
 
@@ -124,7 +127,7 @@ public class DNFactory
 
     public static DN create( DN dn ) throws LdapInvalidDnException
     {
-        return create( dn.getName(), null );
+        return create( dn.getName(), schemaManager );
     }
 
 
@@ -136,7 +139,13 @@ public class DNFactory
 
     public static DN create( String dn ) throws LdapInvalidDnException
     {
-        return create( dn, null );
+        return create( dn, schemaManager );
     }
 
+
+    public static void setSchemaManager( SchemaManager schemaManager )
+    {
+        DNFactory.schemaManager = schemaManager;
+    }
+    
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=981918&r1=981917&r2=981918&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
Tue Aug  3 15:12:54 2010
@@ -1416,6 +1416,8 @@ public class DefaultDirectoryService imp
             LOG.debug( "---> Initializing the DefaultDirectoryService " );
         }
 
+        DNFactory.setSchemaManager( schemaManager );
+        
         // triggers partition to load schema fully from schema partition
         schemaService.initialize();
         schemaService.getSchemaPartition().initialize();

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java?rev=981918&r1=981917&r2=981918&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java
(original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java
Tue Aug  3 15:12:54 2010
@@ -92,6 +92,8 @@ public class SubtreeEvaluatorTest
             fail( "Schema load failed : " + LdapExceptionUtils.printErrors( schemaManager.getErrors()
) );
         }
 
+        DNFactory.setSchemaManager( schemaManager );
+        
         ncn = new ConcreteNameComponentNormalizer( schemaManager );
 
         visitor = new FilterNormalizingVisitor( ncn, schemaManager );



Mime
View raw message