directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r835243 - /directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/RegistrySynchronizerAdaptor.java
Date Thu, 12 Nov 2009 05:54:16 GMT
Author: elecharny
Date: Thu Nov 12 05:54:15 2009
New Revision: 835243

URL: http://svn.apache.org/viewvc?rev=835243&view=rev
Log:
o Added Javadoc
o Fixed error handling in the add method
o Added correct logs
o Add comments

Modified:
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/RegistrySynchronizerAdaptor.java

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/RegistrySynchronizerAdaptor.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/RegistrySynchronizerAdaptor.java?rev=835243&r1=835242&r2=835243&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/RegistrySynchronizerAdaptor.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/RegistrySynchronizerAdaptor.java
Thu Nov 12 05:54:15 2009
@@ -145,14 +145,18 @@
         }
     }
 
-    
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.schema.SchemaChangeManager#add(org.apache.directory.server.core.interceptor.context.AddOperationContext)
+
+    /**
+     * Add a new SchemaObject or a new Schema in the Schema partition.
+     *
+     * @param opContext The Add context, containing the entry to be added
+     * @throws Exception If the addition failed 
      */
     public void add( AddOperationContext opContext ) throws Exception
     {
         EntryAttribute oc = opContext.getEntry().get( objectClassAT );
         
+        // First check if we are adding a schemaObject
         for ( Value<?> value:oc )
         {
 
@@ -160,6 +164,8 @@
             
             if ( objectClass2synchronizerMap.containsKey( oid ) )
             {
+                // This is one of the eleven SchemaObject :
+                // AT, C, DCR, DSR, MR, MRU, NF, N, OC, S, SC
                 RegistrySynchronizer synchronizer = objectClass2synchronizerMap.get( oid
);
                 ServerEntry entry = opContext.getEntry();
                 synchronizer.add( entry );
@@ -167,6 +173,7 @@
             }
         }
         
+        // This is a Schema
         if ( oc.contains( MetaSchemaConstants.META_SCHEMA_OC ) )
         {
             ServerEntry entry = opContext.getEntry();
@@ -174,13 +181,14 @@
             return;
         }
         
+        // What is this for ??? TODO : remove this code if it's useless...
         if ( oc.contains( SchemaConstants.ORGANIZATIONAL_UNIT_OC ) )
         {
             if ( opContext.getDn().size() != 3 )
             {
-                throw new LdapInvalidNameException( 
-                    "Schema entity containers of objectClass organizationalUnit should be
3 name components in length.", 
-                    ResultCodeEnum.NAMING_VIOLATION );
+                String msg = "Schema entity containers of objectClass organizationalUnit
should be 3 name components in length.";
+                LOG.error( msg );
+                throw new LdapInvalidNameException( msg, ResultCodeEnum.NAMING_VIOLATION
);
             }
             
             String ouValue = ( String ) opContext.getDn().getRdn().getValue();
@@ -188,14 +196,16 @@
             
             if ( ! VALID_OU_VALUES.contains( ouValue ) )
             {
-                throw new LdapInvalidNameException( 
-                    "Expecting organizationalUnit with one of the following names: " + VALID_OU_VALUES,

-                    ResultCodeEnum.NAMING_VIOLATION );
+                String msg = "Expecting organizationalUnit with one of the following names:
" + VALID_OU_VALUES;
+                LOG.error( msg );
+                throw new LdapInvalidNameException( msg, ResultCodeEnum.NAMING_VIOLATION
);
             }
-            return;
         }
 
-        throw new LdapOperationNotSupportedException( ResultCodeEnum.UNWILLING_TO_PERFORM
);
+        
+        String msg = "Cannot add an entry on " + opContext.getDn();
+        LOG.error( msg );
+        throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM
);
     }
     
 



Mime
View raw message