directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r834784 - in /directory: apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/...
Date Wed, 11 Nov 2009 07:04:21 GMT
Author: elecharny
Date: Wed Nov 11 07:04:20 2009
New Revision: 834784

URL: http://svn.apache.org/viewvc?rev=834784&view=rev
Log:
o Added some Javadoc
o Move the SchemaManager parameter in all the methods to be at the first position

Modified:
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ComparatorSynchronizer.java
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/MatchingRuleSynchronizer.java
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ObjectClassSynchronizer.java
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SyntaxSynchronizer.java
    directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerIT.java
    directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/EntityFactory.java

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java?rev=834784&r1=834783&r2=834784&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java
Wed Nov 11 07:04:20 2009
@@ -86,7 +86,7 @@
         // Relax the cloned registries
         clonedRegistries.setRelaxed();
         
-        AttributeType at = factory.getAttributeType( entry, clonedRegistries, schemaManager,
schemaName );
+        AttributeType at = factory.getAttributeType( schemaManager, entry, clonedRegistries,
schemaName );
         
         // if the AT is null, that means the schema is disabled
         if ( at != null )
@@ -139,7 +139,7 @@
         ServerEntry entry = opContext.getEntry();
         String schemaName = getSchemaName( name );
         String oid = getOid( entry );
-        AttributeType at = factory.getAttributeType( targetEntry, schemaManager.getRegistries(),
schemaManager, schemaName );
+        AttributeType at = factory.getAttributeType( schemaManager, targetEntry, schemaManager.getRegistries(),
schemaName );
         
         if ( isSchemaEnabled( schemaName ) )
         {
@@ -171,7 +171,7 @@
         
         // Get the AttributeType from the given entry ( it has been grabbed from the server
earlier)
         String schemaName = getSchemaName( entry.getDn() );
-        AttributeType attributeType = factory.getAttributeType( entry, schemaManager.getRegistries(),
schemaManager, schemaName );
+        AttributeType attributeType = factory.getAttributeType( schemaManager, entry, schemaManager.getRegistries(),
schemaName );
         
         // Applies the Registries to this AttributeType 
         Schema schema = schemaManager.getLoadedSchema( schemaName );
@@ -239,7 +239,7 @@
     public void rename( ServerEntry entry, Rdn newRdn, boolean cascade ) throws Exception
     {
         String schemaName = getSchemaName( entry.getDn() );
-        AttributeType oldAt = factory.getAttributeType( entry, schemaManager.getRegistries(),
schemaManager, schemaName );
+        AttributeType oldAt = factory.getAttributeType( schemaManager, entry, schemaManager.getRegistries(),
schemaName );
 
         // Inject the new OID
         ServerEntry targetEntry = ( ServerEntry ) entry.clone();
@@ -253,7 +253,7 @@
         newDn.add( newRdn );
         targetEntry.setDn( newDn );
         
-        AttributeType at = factory.getAttributeType( targetEntry, schemaManager.getRegistries(),
schemaManager, schemaName );
+        AttributeType at = factory.getAttributeType( schemaManager, targetEntry, schemaManager.getRegistries(),
schemaName );
 
         if ( isSchemaEnabled( schemaName ) )
         {
@@ -283,12 +283,12 @@
         checkParent( newParentName, schemaManager, SchemaConstants.ATTRIBUTE_TYPE );
         String oldSchemaName = getSchemaName( oriChildName );
         String newSchemaName = getSchemaName( newParentName );
-        AttributeType oldAt = factory.getAttributeType( entry, schemaManager.getRegistries(),
schemaManager, oldSchemaName );
+        AttributeType oldAt = factory.getAttributeType( schemaManager, entry, schemaManager.getRegistries(),
oldSchemaName );
         ServerEntry targetEntry = ( ServerEntry ) entry.clone();
         String newOid = ( String ) newRn.getValue();
         targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
         checkOidIsUnique( newOid );
-        AttributeType newAt = factory.getAttributeType( targetEntry, schemaManager.getRegistries(),
schemaManager, newSchemaName );
+        AttributeType newAt = factory.getAttributeType( schemaManager, targetEntry, schemaManager.getRegistries(),
newSchemaName );
 
         
         if ( !isSchemaLoaded( oldSchemaName ) )
@@ -334,8 +334,8 @@
         checkParent( newParentName, schemaManager, SchemaConstants.ATTRIBUTE_TYPE );
         String oldSchemaName = getSchemaName( oriChildName );
         String newSchemaName = getSchemaName( newParentName );
-        AttributeType oldAt = factory.getAttributeType( entry, schemaManager.getRegistries(),
schemaManager, oldSchemaName );
-        AttributeType newAt = factory.getAttributeType( entry, schemaManager.getRegistries(),
schemaManager, newSchemaName );
+        AttributeType oldAt = factory.getAttributeType( schemaManager, entry, schemaManager.getRegistries(),
oldSchemaName );
+        AttributeType newAt = factory.getAttributeType( schemaManager, entry, schemaManager.getRegistries(),
newSchemaName );
         
         if ( !isSchemaLoaded( oldSchemaName ) )
         {

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ComparatorSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ComparatorSynchronizer.java?rev=834784&r1=834783&r2=834784&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ComparatorSynchronizer.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ComparatorSynchronizer.java
Wed Nov 11 07:04:20 2009
@@ -108,12 +108,15 @@
         
         LdapComparator<?> comparator = factory.getLdapComparator( schemaManager, entry,
schemaManager.getRegistries(), schemaName );
         
-        addToSchema( comparator, schemaName );
-
-        if ( isSchemaEnabled( schemaName ) && comparator.isEnabled() )
+        if ( comparator != null )
         {
-            schemaManager.register( comparator );
-            LOG.debug( "Added {} into the enabled schema {}", dn.getUpName(), schemaName
);
+            addToSchema( comparator, schemaName );
+
+            if ( isSchemaEnabled( schemaName ) && comparator.isEnabled() )
+            {
+                schemaManager.register( comparator );
+                LOG.debug( "Added {} into the enabled schema {}", dn.getUpName(), schemaName
);
+            }
         }
     }
 

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/MatchingRuleSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/MatchingRuleSynchronizer.java?rev=834784&r1=834783&r2=834784&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/MatchingRuleSynchronizer.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/MatchingRuleSynchronizer.java
Wed Nov 11 07:04:20 2009
@@ -71,7 +71,7 @@
         LdapDN name = opContext.getDn();
         ServerEntry entry = opContext.getEntry();
         String schemaName = getSchemaName( name );
-        MatchingRule mr = factory.getMatchingRule( targetEntry, schemaManager.getRegistries(),
schemaName );
+        MatchingRule mr = factory.getMatchingRule( schemaManager, targetEntry, schemaManager.getRegistries(),
schemaName );
         
         String oldOid = getOid( entry );
         
@@ -106,7 +106,7 @@
         
         // Build the new MatchingRule from the given entry
         String schemaName = getSchemaName( dn );
-        MatchingRule matchingRule = factory.getMatchingRule( entry, schemaManager.getRegistries(),
schemaName );
+        MatchingRule matchingRule = factory.getMatchingRule( schemaManager, entry, schemaManager.getRegistries(),
schemaName );
         
         // At this point, the constructed MatchingRule has not been checked against the 
         // existing Registries. It may be broken (missing SYNTAX), it will be checked
@@ -159,7 +159,7 @@
 
         // Get the MatchingRule from the given entry ( it has been grabbed from the server
earlier)
         String schemaName = getSchemaName( entry.getDn() );
-        MatchingRule matchingRule = factory.getMatchingRule( entry, schemaManager.getRegistries(),
schemaName );
+        MatchingRule matchingRule = factory.getMatchingRule( schemaManager, entry, schemaManager.getRegistries(),
schemaName );
         String oid = matchingRule.getOid();
         
         // Applies the Registries to this MatchingRule 
@@ -203,13 +203,13 @@
     public void rename( ServerEntry entry, Rdn newRdn, boolean cascade ) throws Exception
     {
         String schemaName = getSchemaName( entry.getDn() );
-        MatchingRule oldMr = factory.getMatchingRule( entry, schemaManager.getRegistries(),
schemaName );
+        MatchingRule oldMr = factory.getMatchingRule( schemaManager, entry, schemaManager.getRegistries(),
schemaName );
         ServerEntry targetEntry = ( ServerEntry ) entry.clone();
         String newOid = ( String ) newRdn.getValue();
         checkOidIsUnique( newOid );
         
         targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
-        MatchingRule mr = factory.getMatchingRule( targetEntry, schemaManager.getRegistries(),
schemaName );
+        MatchingRule mr = factory.getMatchingRule( schemaManager, targetEntry, schemaManager.getRegistries(),
schemaName );
 
         if ( isSchemaEnabled( schemaName ) )
         {
@@ -230,13 +230,13 @@
         checkNewParent( newParentName );
         String oldSchemaName = getSchemaName( oriChildName );
         String newSchemaName = getSchemaName( newParentName );
-        MatchingRule oldMr = factory.getMatchingRule( entry, schemaManager.getRegistries(),
oldSchemaName );
+        MatchingRule oldMr = factory.getMatchingRule( schemaManager, entry, schemaManager.getRegistries(),
oldSchemaName );
         ServerEntry targetEntry = ( ServerEntry ) entry.clone();
         String newOid = ( String ) newRdn.getValue();
         checkOidIsUnique( newOid );
         
         targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
-        MatchingRule mr = factory.getMatchingRule( targetEntry, schemaManager.getRegistries(),
newSchemaName );
+        MatchingRule mr = factory.getMatchingRule( schemaManager, targetEntry, schemaManager.getRegistries(),
newSchemaName );
         
         if ( isSchemaEnabled( oldSchemaName ) )
         {
@@ -264,8 +264,8 @@
         checkNewParent( newParentName );
         String oldSchemaName = getSchemaName( oriChildName );
         String newSchemaName = getSchemaName( newParentName );
-        MatchingRule oldMr = factory.getMatchingRule( entry, schemaManager.getRegistries(),
oldSchemaName );
-        MatchingRule newMr = factory.getMatchingRule( entry, schemaManager.getRegistries(),
newSchemaName );
+        MatchingRule oldMr = factory.getMatchingRule( schemaManager, entry, schemaManager.getRegistries(),
oldSchemaName );
+        MatchingRule newMr = factory.getMatchingRule( schemaManager, entry, schemaManager.getRegistries(),
newSchemaName );
 
         if ( isSchemaEnabled( oldSchemaName ) )
         {

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ObjectClassSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ObjectClassSynchronizer.java?rev=834784&r1=834783&r2=834784&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ObjectClassSynchronizer.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ObjectClassSynchronizer.java
Wed Nov 11 07:04:20 2009
@@ -71,7 +71,7 @@
         LdapDN name = opContext.getDn();
         ServerEntry entry = opContext.getEntry();
         String oid = getOid( entry );
-        ObjectClass oc = factory.getObjectClass( targetEntry, schemaManager.getRegistries(),
getSchemaName( name ) );
+        ObjectClass oc = factory.getObjectClass( schemaManager, targetEntry, schemaManager.getRegistries(),
getSchemaName( name ) );
         String schemaName = getSchemaName( entry.getDn() );
 
         if ( isSchemaEnabled( schemaName ) )
@@ -103,7 +103,7 @@
         
         // Build the new ObjectClass from the given entry
         String schemaName = getSchemaName( dn );
-        ObjectClass objectClass = factory.getObjectClass( entry, schemaManager.getRegistries(),
schemaName );
+        ObjectClass objectClass = factory.getObjectClass( schemaManager, entry, schemaManager.getRegistries(),
schemaName );
 
         // At this point, the constructed ObjectClass has not been checked against the 
         // existing Registries. It may be broken (missing SUPs), it will be checked
@@ -164,7 +164,7 @@
         
         // Get the ObjectClass from the given entry ( it has been grabbed from the server
earlier)
         String schemaName = getSchemaName( entry.getDn() );
-        ObjectClass objectClass = factory.getObjectClass( entry, schemaManager.getRegistries(),
schemaName );
+        ObjectClass objectClass = factory.getObjectClass( schemaManager, entry, schemaManager.getRegistries(),
schemaName );
 
         // Applies the Registries to this ObjectClass 
         Schema schema = schemaManager.getLoadedSchema( schemaName );
@@ -230,7 +230,7 @@
     public void rename( ServerEntry entry, Rdn newRdn, boolean cascade ) throws Exception
     {
         String schemaName = getSchemaName( entry.getDn() );
-        ObjectClass oldOc = factory.getObjectClass( entry, schemaManager.getRegistries(),
schemaName );
+        ObjectClass oldOc = factory.getObjectClass( schemaManager, entry, schemaManager.getRegistries(),
schemaName );
 
         // Dependency constraints are not managed by this class
 //        Set<ServerEntry> dependees = dao.listObjectClassDependents( oldOc );
@@ -254,7 +254,7 @@
         newDn.add( newRdn );
         
         checkOidIsUnique( newOid );
-        ObjectClass oc = factory.getObjectClass( targetEntry, schemaManager.getRegistries(),
schemaName );
+        ObjectClass oc = factory.getObjectClass( schemaManager, targetEntry, schemaManager.getRegistries(),
schemaName );
 
         if ( isSchemaEnabled( schemaName ) )
         {
@@ -283,7 +283,7 @@
     {
         checkNewParent( newParentName );
         String oldSchemaName = getSchemaName( oriChildName );
-        ObjectClass oldOc = factory.getObjectClass( entry, schemaManager.getRegistries(),
oldSchemaName );
+        ObjectClass oldOc = factory.getObjectClass( schemaManager, entry, schemaManager.getRegistries(),
oldSchemaName );
 
         // this class does not handle dependencies
 //        Set<ServerEntry> dependees = dao.listObjectClassDependents( oldOc );
@@ -301,7 +301,7 @@
         String newOid = ( String ) newRdn.getValue();
         checkOidIsUnique( newOid );
         targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
-        ObjectClass oc = factory.getObjectClass( targetEntry, schemaManager.getRegistries(),
newSchemaName );
+        ObjectClass oc = factory.getObjectClass( schemaManager, targetEntry, schemaManager.getRegistries(),
newSchemaName );
 
         if ( isSchemaEnabled( oldSchemaName ) )
         {
@@ -329,7 +329,7 @@
         checkNewParent( newParentName );
         String oldSchemaName = getSchemaName( oriChildName );
         String newSchemaName = getSchemaName( newParentName );
-        ObjectClass oldAt = factory.getObjectClass( entry, schemaManager.getRegistries(),
oldSchemaName );
+        ObjectClass oldAt = factory.getObjectClass( schemaManager, entry, schemaManager.getRegistries(),
oldSchemaName );
 
         // dependencies are not managed by this class
 //        Set<ServerEntry> dependees = dao.listObjectClassDependents( oldAt );
@@ -342,7 +342,7 @@
 //                ResultCodeEnum.UNWILLING_TO_PERFORM );
 //        }
 
-        ObjectClass oc = factory.getObjectClass( entry, schemaManager.getRegistries(), newSchemaName
);
+        ObjectClass oc = factory.getObjectClass( schemaManager, entry, schemaManager.getRegistries(),
newSchemaName );
         
         if ( isSchemaEnabled( oldSchemaName ) )
         {

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SyntaxSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SyntaxSynchronizer.java?rev=834784&r1=834783&r2=834784&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SyntaxSynchronizer.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SyntaxSynchronizer.java
Wed Nov 11 07:04:20 2009
@@ -77,7 +77,7 @@
         LdapDN name = opContext.getDn();
         ServerEntry entry = opContext.getEntry();
         String oid = getOid( entry );
-        LdapSyntax syntax = factory.getSyntax( targetEntry, schemaManager.getRegistries(),
getSchemaName( name ) );
+        LdapSyntax syntax = factory.getSyntax( schemaManager, targetEntry, schemaManager.getRegistries(),
getSchemaName( name ) );
         String schemaName = getSchemaName( entry.getDn() );
         
         if ( isSchemaEnabled( schemaName ) )
@@ -109,7 +109,7 @@
         
         // Build the new Syntax from the given entry
         String schemaName = getSchemaName( dn );
-        LdapSyntax syntax = factory.getSyntax( entry, schemaManager.getRegistries(), schemaName
);
+        LdapSyntax syntax = factory.getSyntax( schemaManager, entry, schemaManager.getRegistries(),
schemaName );
 
         // Applies the Registries to this Syntax 
         Schema schema = schemaManager.getLoadedSchema( schemaName );
@@ -206,7 +206,7 @@
         
         // Get the Syntax from the given entry ( it has been grabbed from the server earlier)
         String schemaName = getSchemaName( entry.getDn() );
-        LdapSyntax syntax = factory.getSyntax( entry, schemaManager.getRegistries(), schemaName
);
+        LdapSyntax syntax = factory.getSyntax( schemaManager, entry, schemaManager.getRegistries(),
schemaName );
         
         // Applies the Registries to this Syntax 
         Schema schema = schemaManager.getLoadedSchema( schemaName );
@@ -275,7 +275,7 @@
         checkOidIsUnique( newOid );
         
         targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
-        LdapSyntax syntax = factory.getSyntax( targetEntry, schemaManager.getRegistries(),
getSchemaName( entry.getDn() ) );
+        LdapSyntax syntax = factory.getSyntax( schemaManager, targetEntry, schemaManager.getRegistries(),
getSchemaName( entry.getDn() ) );
         
         if ( isSchemaEnabled( schemaName ) )
         {
@@ -317,7 +317,7 @@
         checkOidIsUnique( newOid );
         
         targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
-        LdapSyntax syntax = factory.getSyntax( targetEntry, schemaManager.getRegistries(),
getSchemaName( newParentName ) );
+        LdapSyntax syntax = factory.getSyntax( schemaManager, targetEntry, schemaManager.getRegistries(),
getSchemaName( newParentName ) );
 
         if ( isSchemaEnabled( oldSchemaName ) )
         {
@@ -361,7 +361,7 @@
 //                ResultCodeEnum.UNWILLING_TO_PERFORM );
 //        }
         
-        LdapSyntax syntax = factory.getSyntax( entry, schemaManager.getRegistries(), getSchemaName(
newParentName ) );
+        LdapSyntax syntax = factory.getSyntax( schemaManager, entry, schemaManager.getRegistries(),
getSchemaName( newParentName ) );
         
         if ( isSchemaEnabled( oldSchemaName ) )
         {

Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerIT.java?rev=834784&r1=834783&r2=834784&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerIT.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerIT.java
Wed Nov 11 07:04:20 2009
@@ -29,6 +29,7 @@
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 
+import javax.naming.NameNotFoundException;
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
@@ -143,6 +144,37 @@
 
 
     @Test
+    public void testAddComparatorToUnloadedSchema() throws Exception
+    {
+        Attributes attrs = AttributeUtils.createAttributes( 
+            "objectClass: top",
+            "objectClass: metaTop",
+            "objectClass: metaComparator",
+            "m-fqcn: " + StringComparator.class.getName(),
+            "m-oid: " + OID,
+            "m-description: A test comparator" );
+        
+        // nis is by default inactive
+        LdapDN dn = getComparatorContainer( "notloaded" );
+        dn.add( "m-oid" + "=" + OID );
+        
+        try
+        {
+            getSchemaContext( service ).createSubcontext( dn, attrs );
+            fail( "Should not be there" );
+        }
+        catch( NameNotFoundException nnfe )
+        {
+            // Expected result.
+        }
+        
+        assertFalse( "adding new comparator to disabled schema should not register it into
the registries", 
+            schemaManager.getComparatorRegistry().contains( OID ) );
+        assertFalse( isOnDisk( dn ) );
+    }
+
+
+    @Test
     public void testAddComparatorWithByteCodeToEnabledSchema() throws Exception
     {
         InputStream in = getClass().getResourceAsStream( "DummyComparator.bytecode" );

Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java?rev=834784&r1=834783&r2=834784&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java
Wed Nov 11 07:04:20 2009
@@ -1429,7 +1429,7 @@
         
         ServerEntry serverEntry = ServerEntryUtils.toServerEntry( attrs, LdapDN.EMPTY_LDAPDN,
service.getSchemaManager() );
         
-        AttributeType at = factory.getAttributeType( serverEntry, service.getSchemaManager().getRegistries(),
service.getSchemaManager(), "nis" );
+        AttributeType at = factory.getAttributeType( service.getSchemaManager(), serverEntry,
service.getSchemaManager().getRegistries(), "nis" );
         assertEquals( "1.3.6.1.4.1.18060.0.4.0.2.10000", at.getOid() );
         assertEquals( "name", at.getSuperior().getName() );
         assertEquals( "bogus description", at.getDescription() );
@@ -1492,7 +1492,7 @@
         
         ServerEntry serverEntry = ServerEntryUtils.toServerEntry( attrs, LdapDN.EMPTY_LDAPDN,
service.getSchemaManager() );
 
-        AttributeType at = factory.getAttributeType( serverEntry, service.getSchemaManager().getRegistries(),
service.getSchemaManager(), "nis" );
+        AttributeType at = factory.getAttributeType( service.getSchemaManager(), serverEntry,
service.getSchemaManager().getRegistries(), "nis" );
         assertEquals( "1.3.6.1.4.1.18060.0.4.0.2.10000", at.getOid() );
         assertEquals( "name", at.getSuperior().getName() );
         assertEquals( "bogus description", at.getDescription() );

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/EntityFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/EntityFactory.java?rev=834784&r1=834783&r2=834784&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/EntityFactory.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/EntityFactory.java
Wed Nov 11 07:04:20 2009
@@ -12,50 +12,50 @@
 
 public interface EntityFactory
 {
-    Schema getSchema( Entry entry ) throws Exception;
-    
     /**
-     * Retrieve and load a syntaxChecker class from the DIT.
-     * 
-     * @param entry the entry to load the syntaxChecker from
-     * @return the loaded SyntaxChecker
-     * @throws NamingException if anything fails during loading
+     * Return an instance of the Schema associated to the entry
+     *
+     * @param entry The Schema entry
+     * @return An instance of a Schema
+     * @throws Exception If the instance can't be created
      */
-    SyntaxChecker getSyntaxChecker( SchemaManager schemaManager, Entry entry, Registries
targetRegistries, String schemaName ) throws Exception;
+    Schema getSchema( Entry entry ) throws Exception;
+    
     
-
     /**
-     * Create a new instance of a SyntaxChecker 
+     * Construct an AttributeType from an entry representing an AttributeType.
      *
-     * @param syntaxCheckerDescription
-     * @param targetRegistries
-     * @param schemaName
-     * @return A new instance of a syntaxChecker
-     * @throws Exception If the creation has failed
+     * @param schemaManager The Schema Manager
+     * @param entry The entry containing all the informations to build an AttributeType
+     * @param targetRegistries The registries containing all the enabled SchemaObjects
+     * @param schemaName The schema this SchemaObject will be part of
+     * @return An AttributeType SchemaObject
+     * @throws NamingException If the AttributeType is invalid
      */
-    SyntaxChecker getSyntaxChecker( SchemaManager schemaManager, SyntaxCheckerDescription
syntaxCheckerDescription, 
-        Registries targetRegistries, String schemaName ) throws Exception;
-
+    AttributeType getAttributeType( SchemaManager schemaManager, Entry entry, Registries
targetRegistries, String schemaName ) throws NamingException;
 
+    
     /**
-     * Create a new instance of a LdapComparator 
+     * Construct a LdapComparator from a description of a comparator.
      *
-     * @param comparatorDescription
-     * @param targetRegistries
-     * @param schemaName
+     * @param schemaManager The Schema Manager
+     * @param comparatorDescription The LdapComparator description object 
+     * @param targetRegistries The registries containing all the enabled SchemaObjects
+     * @param schemaName The schema this SchemaObject will be part of
      * @return A new instance of a LdapComparator
      * @throws Exception If the creation has failed
      */
     LdapComparator<?> getLdapComparator( SchemaManager schemaManager, 
         LdapComparatorDescription comparatorDescription, 
         Registries targetRegistries, String schemaName ) throws Exception;
-
-
+    
+    
     /**
      * Retrieve and load a Comparator class from the DIT.
      * 
-     * @param entry the entry to load the Comparator from
-     * @param targetRegistries The registries
+     * @param schemaManager The Schema Manager
+     * @param entry The entry containing all the informations to build a LdapComparator
+     * @param targetRegistries The registries containing all the enabled SchemaObjects
      * @param schemaName The schema this SchemaObject will be part of
      * @return the loaded Comparator
      * @throws NamingException if anything fails during loading
@@ -63,13 +63,27 @@
     LdapComparator<?> getLdapComparator( SchemaManager schemaManager, Entry entry,

         Registries targetRegistries, String schemaName ) throws Exception;
     
-    
+
+    /**
+     * Construct an MatchingRule from an entry get from the Dit
+     *
+     * @param schemaManager The Schema Manager
+     * @param entry The entry containing all the informations to build a MatchingRule
+     * @param targetRegistries The registries containing all the enabled SchemaObjects
+     * @param schemaName The schema this SchemaObject will be part of
+     * @return A MatchingRule SchemaObject
+     * @throws NamingException If the MatchingRule is invalid
+     */
+    MatchingRule getMatchingRule( SchemaManager schemaManager, Entry entry, Registries targetRegistries,
String schemaName ) throws NamingException;
+
+
     /**
      * Create a new instance of a Normalizer 
      *
-     * @param normalizerDescription
-     * @param targetRegistries
-     * @param schemaName
+     * @param schemaManager The Schema Manager
+     * @param normalizerDescription The Normalizer description object 
+     * @param targetRegistries The registries containing all the enabled SchemaObjects
+     * @param schemaName The schema this SchemaObject will be part of
      * @return A new instance of a normalizer
      * @throws Exception If the creation has failed
      */
@@ -80,7 +94,10 @@
     /**
      * Retrieve and load a Normalizer class from the DIT.
      * 
-     * @param entry the entry to load the Normalizer from
+     * @param schemaManager The Schema Manager
+     * @param entry The entry containing all the informations to build a Normalizer
+     * @param targetRegistries The registries containing all the enabled SchemaObjects
+     * @param schemaName The schema this SchemaObject will be part of
      * @return the loaded Normalizer
      * @throws NamingException if anything fails during loading
      */
@@ -88,33 +105,53 @@
         throws Exception;
     
     
-    LdapSyntax getSyntax( Entry entry, Registries targetRegistries, String schemaName ) throws
NamingException;
+    /**
+     * 
+     * @param schemaManager The Schema Manager
+     * @param entry The entry containing all the informations to build an ObjectClass
+     * @param targetRegistries The registries containing all the enabled SchemaObjects
+     * @param schemaName The schema this SchemaObject will be part of
+     * @return
+     * @throws Exception
+     */
+    ObjectClass getObjectClass( SchemaManager schemaManager, Entry entry, Registries targetRegistries,
String schemaName ) throws Exception;
     
     
     /**
-     * Construct an MatchingRule from an entry get from the Dit
-     *
-     * @param entry The entry containing all the informations to build a MatchingRule
+     * 
+     * @param schemaManager The Schema Manager
+     * @param entry The entry containing all the informations to build a LdapSyntax
      * @param targetRegistries The registries containing all the enabled SchemaObjects
-     * @param schemaName The schema containing this MatchingRule
-     * @return A MatchingRule SchemaObject
-     * @throws NamingException If the MatchingRule is invalid
+     * @param schemaName The schema this SchemaObject will be part of
+     * @return
+     * @throws NamingException
      */
-    MatchingRule getMatchingRule( Entry entry, Registries targetRegistries, String schemaName
) throws NamingException;
-
-
-    ObjectClass getObjectClass( Entry entry, Registries targetRegistries, String schemaName
) throws Exception;
+    LdapSyntax getSyntax( SchemaManager schemaManager, Entry entry, Registries targetRegistries,
String schemaName ) throws NamingException;
     
     
     /**
-     * Construct an AttributeType from an entry representing an AttributeType.
+     * Retrieve and load a syntaxChecker class from the DIT.
+     * 
+     * @param schemaManager The Schema Manager
+     * @param entry The entry containing all the informations to build a SyntaxChecker
+     * @param targetRegistries The registries containing all the enabled SchemaObjects
+     * @param schemaName The schema this SchemaObject will be part of
+     * @return the loaded SyntaxChecker
+     * @throws NamingException if anything fails during loading
+     */
+    SyntaxChecker getSyntaxChecker( SchemaManager schemaManager, Entry entry, Registries
targetRegistries, String schemaName ) throws Exception;
+    
+
+    /**
+     * Create a new instance of a SyntaxChecker 
      *
-     * @param entry The entry containing all the informations to build an AttributeType
+     * @param schemaManager The Schema Manager
+     * @param syntaxCheckerDescription The SyntaxChecker description object 
      * @param targetRegistries The registries containing all the enabled SchemaObjects
-     * @param schemaManager The SchemaManager
-     * @param schemaName The schema containing this AttributeType
-     * @return An AttributeType SchemaObject
-     * @throws NamingException If the AttributeType is invalid
+     * @param schemaName The schema this SchemaObject will be part of
+     * @return A new instance of a syntaxChecker
+     * @throws Exception If the creation has failed
      */
-    AttributeType getAttributeType( Entry entry, Registries targetRegistries, SchemaManager
schemaManager, String schemaName ) throws NamingException;
+    SyntaxChecker getSyntaxChecker( SchemaManager schemaManager, SyntaxCheckerDescription
syntaxCheckerDescription, 
+        Registries targetRegistries, String schemaName ) throws Exception;
 }



Mime
View raw message