directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r491155 - in /directory/branches/trunks/schema/apacheds: core-unit/src/test/java/org/apache/directory/server/core/ core/src/main/java/org/apache/directory/server/core/partition/ core/src/main/java/org/apache/directory/server/core/schema/ sc...
Date Sat, 30 Dec 2006 02:49:28 GMT
Author: akarasulu
Date: Fri Dec 29 18:49:27 2006
New Revision: 491155

URL: http://svn.apache.org/viewvc?view=rev&rev=491155
Log:
fixed a bug with loading attribute type names from schema partition; added some logging

Modified:
    directory/branches/trunks/schema/apacheds/core-unit/src/test/java/org/apache/directory/server/core/SearchOpsITest.java
    directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
    directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java
    directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java
    directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java
    directory/branches/trunks/schema/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/AbstractSchemaLoader.java
    directory/branches/trunks/schema/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultComparatorRegistry.java

Modified: directory/branches/trunks/schema/apacheds/core-unit/src/test/java/org/apache/directory/server/core/SearchOpsITest.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/core-unit/src/test/java/org/apache/directory/server/core/SearchOpsITest.java?view=diff&rev=491155&r1=491154&r2=491155
==============================================================================
--- directory/branches/trunks/schema/apacheds/core-unit/src/test/java/org/apache/directory/server/core/SearchOpsITest.java
(original)
+++ directory/branches/trunks/schema/apacheds/core-unit/src/test/java/org/apache/directory/server/core/SearchOpsITest.java
Fri Dec 29 18:49:27 2006
@@ -37,8 +37,6 @@
 import org.apache.directory.server.core.configuration.MutablePartitionConfiguration;
 import org.apache.directory.server.core.partition.impl.btree.MutableIndexConfiguration;
 import org.apache.directory.server.core.unit.AbstractAdminTestCase;
-import org.apache.directory.server.schema.bootstrap.BootstrapSchema;
-import org.apache.directory.server.schema.bootstrap.NisSchema;
 
 
 /**
@@ -90,10 +88,22 @@
         // Enable the nis schema
         // -------------------------------------------------------------------
 
-        Attribute disabled = new BasicAttribute( "m-disabled" );
-        ModificationItem[] mods = new ModificationItem[] { 
-            new ModificationItem( DirContext.REMOVE_ATTRIBUTE, disabled ) };
-        schemaRoot.modifyAttributes( "cn=nis", mods );
+        // check if nis is disabled
+        Attributes nisAttrs = schemaRoot.getAttributes( "cn=nis" );
+        boolean isNisDisabled = false;
+        if ( nisAttrs.get( "m-disabled" ) != null )
+        {
+            isNisDisabled = ( ( String ) nisAttrs.get( "m-disabled" ).get() ).equalsIgnoreCase(
"TRUE" );
+        }
+        
+        // if nis is disabled then enable it
+        if ( isNisDisabled )
+        {
+            Attribute disabled = new BasicAttribute( "m-disabled" );
+            ModificationItem[] mods = new ModificationItem[] { 
+                new ModificationItem( DirContext.REMOVE_ATTRIBUTE, disabled ) };
+            schemaRoot.modifyAttributes( "cn=nis", mods );
+        }
         
         // -------------------------------------------------------------------
         // Add a bunch of nis groups

Modified: directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?view=diff&rev=491155&r1=491154&r2=491155
==============================================================================
--- directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
(original)
+++ directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
Fri Dec 29 18:49:27 2006
@@ -278,12 +278,12 @@
             }
             
             // add all attribute oids of index configs to a hashset
-            Set<String> indices = systemCfg.getIndexedAttributes();
+            Set indices = systemCfg.getIndexedAttributes();
             Set<String> indexOids = new HashSet<String>();
             OidRegistry registry = factoryCfg.getRegistries().getOidRegistry();
-            for ( Iterator ii = indices.iterator(); ii.hasNext(); /**/ )
+            for ( Object index : indices )
             {
-                indexOids.add( registry.getOid( ii.next().toString() ) );
+                indexOids.add( registry.getOid( index.toString() ) );
             }
             
             if ( ! indexOids.contains( Oid.ALIAS ) )

Modified: directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java?view=diff&rev=491155&r1=491154&r2=491155
==============================================================================
--- directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java
(original)
+++ directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java
Fri Dec 29 18:49:27 2006
@@ -61,6 +61,8 @@
 import org.apache.directory.shared.ldap.schema.Syntax;
 import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.syntax.SyntaxChecker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -71,6 +73,9 @@
  */
 public class PartitionSchemaLoader extends AbstractSchemaLoader
 {
+    /** static class logger */
+    private final static Logger log = LoggerFactory.getLogger( PartitionSchemaLoader.class
);
+    
     private SchemaEntityFactory factory;
     private Partition partition;
     private OidRegistry oidRegistry;
@@ -94,18 +99,23 @@
      */
     public void loadEnabled( Registries registries ) throws NamingException
     {
-        Map<String, Schema> schemas = getSchemas();
-        Set<Schema> schemaSet = new HashSet<Schema>();
+        Map<String, Schema> allSchemaMap = getSchemas();
+        Set<Schema> enabledSchemaSet = new HashSet<Schema>();
 
-        for ( Schema schema: schemas.values() )
+        for ( Schema schema: allSchemaMap.values() )
         {
             if ( ! schema.isDisabled() )
             {
-                schemaSet.add( schema );
+                log.info( "will attempt to load enabled schema: {}", schema.getSchemaName()
);
+                enabledSchemaSet.add( schema );
+            }
+            else
+            {
+                log.info( "will NOT attempt to load disabled schema: {}", schema.getSchemaName()
);
             }
         }
 
-        loadWithDependencies( schemaSet, registries );
+        loadWithDependencies( enabledSchemaSet, registries );
     }
     
     
@@ -189,10 +199,12 @@
     {
         if ( registries.getLoadedSchemas().containsKey( schema.getSchemaName() ) )
         {
+            log.debug( "schema {} already seems to be loaded", schema.getSchemaName() );
             return;
         }
         
-
+        log.info( "loading {} schema ...", schema.getSchemaName() );
+        
         loadComparators( schema, registries.getComparatorRegistry() );
         loadNormalizers( schema, registries.getNormalizerRegistry() );
         loadSyntaxCheckers( schema, registries.getSyntaxCheckerRegistry() );
@@ -219,7 +231,6 @@
     private void loadMatchingRuleUses( Schema schema, MatchingRuleUseRegistry matchingRuleUseRegistry
)
     {
         // TODO Auto-generated method stub
-        
     }
 
 
@@ -238,7 +249,6 @@
     private void loadDitContentRules( Schema schema, DITContentRuleRegistry registry ) throws
NamingException
     {
         // TODO Auto-generated method stub
-        
     }
 
 
@@ -252,6 +262,8 @@
             return;
         }
         
+        log.info( "{} schema: loading objectClasses", schema.getSchemaName() );
+        
         NamingEnumeration list = partition.list( dn );
         while ( list.hasMore() )
         {
@@ -275,6 +287,8 @@
             return;
         }
         
+        log.info( "{} schema: loading attributeTypes", schema.getSchemaName() );
+        
         NamingEnumeration list = partition.list( dn );
         while ( list.hasMore() )
         {
@@ -298,6 +312,8 @@
             return;
         }
         
+        log.info( "{} schema: loading matchingRules", schema.getSchemaName() );
+        
         NamingEnumeration list = partition.list( dn );
         while ( list.hasMore() )
         {
@@ -322,6 +338,8 @@
             return;
         }
         
+        log.info( "{} schema: loading syntaxes", schema.getSchemaName() );
+        
         NamingEnumeration list = partition.list( dn );
         while ( list.hasMore() )
         {
@@ -345,6 +363,8 @@
             return;
         }
         
+        log.info( "{} schema: loading syntaxCheckers", schema.getSchemaName() );
+        
         NamingEnumeration list = partition.list( dn );
         while ( list.hasMore() )
         {
@@ -368,6 +388,8 @@
             return;
         }
         
+        log.info( "{} schema: loading normalizers", schema.getSchemaName() );
+        
         NamingEnumeration list = partition.list( dn );
         while ( list.hasMore() )
         {
@@ -391,6 +413,8 @@
         {
             return;
         }
+        
+        log.info( "{} schema: loading comparators", schema.getSchemaName() );
         
         NamingEnumeration list = partition.list( dn );
         while ( list.hasMore() )

Modified: directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java?view=diff&rev=491155&r1=491154&r2=491155
==============================================================================
--- directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java
(original)
+++ directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java
Fri Dec 29 18:49:27 2006
@@ -590,6 +590,7 @@
     {
         String oid = ( String ) entry.get( MetaSchemaConstants.M_OID_AT ).get();
         AttributeTypeImpl at = new AttributeTypeImpl( oid, registries );
+        setSchemaObjectProperties( at, entry );
         
         if ( entry.get( MetaSchemaConstants.M_SYNTAX_AT ) != null )
         {

Modified: directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java?view=diff&rev=491155&r1=491154&r2=491155
==============================================================================
--- directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java
(original)
+++ directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java
Fri Dec 29 18:49:27 2006
@@ -59,7 +59,6 @@
     {
         this.loader = loader;
         this.globalRegistries = globalRegistries;
-        
         this.objectClassAT = this.globalRegistries.getAttributeTypeRegistry()
             .lookup( SystemSchemaConstants.OBJECT_CLASS_AT );
         this.metaSchemaModifyHandler = new MetaSchemaModifyHandler( this.globalRegistries,
this.loader );

Modified: directory/branches/trunks/schema/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/AbstractSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/AbstractSchemaLoader.java?view=diff&rev=491155&r1=491154&r2=491155
==============================================================================
--- directory/branches/trunks/schema/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/AbstractSchemaLoader.java
(original)
+++ directory/branches/trunks/schema/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/AbstractSchemaLoader.java
Fri Dec 29 18:49:27 2006
@@ -26,6 +26,8 @@
 import javax.naming.NamingException;
 
 import org.apache.directory.server.schema.bootstrap.Schema;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 
@@ -37,6 +39,9 @@
  */
 public abstract class AbstractSchemaLoader implements SchemaLoader
 {
+    /** static class logger */
+    private final static Logger log = LoggerFactory.getLogger( AbstractSchemaLoader.class
);
+    
     protected SchemaLoaderListener listener;
     
     

Modified: directory/branches/trunks/schema/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultComparatorRegistry.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultComparatorRegistry.java?view=diff&rev=491155&r1=491154&r2=491155
==============================================================================
--- directory/branches/trunks/schema/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultComparatorRegistry.java
(original)
+++ directory/branches/trunks/schema/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultComparatorRegistry.java
Fri Dec 29 18:49:27 2006
@@ -27,8 +27,6 @@
 
 import javax.naming.NamingException;
 
-import org.apache.directory.server.schema.SerializableComparator;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 



Mime
View raw message