You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2012/01/03 13:35:00 UTC

svn commit: r1226758 - in /directory/apacheds/branches/apacheds-txns: core-shared/src/main/java/org/apache/directory/server/core/shared/ interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/ protocol-ldap/src/main/jav...

Author: elecharny
Date: Tue Jan  3 12:34:59 2012
New Revision: 1226758

URL: http://svn.apache.org/viewvc?rev=1226758&view=rev
Log:
o Added back the add() method in the Normalization interceptor, for cases where the entry is not schemaAware

Modified:
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultCoreSession.java
    directory/apacheds/branches/apacheds-txns/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
    directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/LdapRequestHandler.java

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultCoreSession.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultCoreSession.java?rev=1226758&r1=1226757&r2=1226758&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultCoreSession.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultCoreSession.java Tue Jan  3 12:34:59 2012
@@ -89,13 +89,13 @@ public class DefaultCoreSession implemen
 {
     /** The DirectoryService we are connected to */
     private final DirectoryService directoryService;
-    
+
     /** The Principal used to process operations */
     private final LdapPrincipal authenticatedPrincipal;
-    
+
     /** The anonymous principal, if we have to process operation as anonymous */
     private final LdapPrincipal anonymousPrincipal;
-    
+
     /** The authorized principal, which will be used when a user has been authorized */
     private LdapPrincipal authorizedPrincipal;
 
@@ -198,6 +198,7 @@ public class DefaultCoreSession implemen
         addContext.setLogChange( log );
 
         OperationManager operationManager = directoryService.getOperationManager();
+
         try
         {
             operationManager.add( addContext );
@@ -226,7 +227,7 @@ public class DefaultCoreSession implemen
             }
             else if ( value instanceof byte[] )
             {
-                val = new StringValue( attributeType, Strings.utf8ToString((byte[]) value) );
+                val = new StringValue( attributeType, Strings.utf8ToString( ( byte[] ) value ) );
             }
             else
             {
@@ -237,7 +238,7 @@ public class DefaultCoreSession implemen
         {
             if ( value instanceof String )
             {
-                val = new BinaryValue( attributeType, Strings.getBytesUtf8((String) value) );
+                val = new BinaryValue( attributeType, Strings.getBytesUtf8( ( String ) value ) );
             }
             else if ( value instanceof byte[] )
             {
@@ -445,7 +446,7 @@ public class DefaultCoreSession implemen
     public boolean isAdministrator()
     {
         String normName = getEffectivePrincipal().getName();
-        
+
         return normName.equals( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
     }
 
@@ -535,7 +536,7 @@ public class DefaultCoreSession implemen
     {
         OperationManager operationManager = directoryService.getOperationManager();
         LookupOperationContext lookupContext = new LookupOperationContext( this, dn, attrIds );
-        
+
         if ( controls != null )
         {
             lookupContext.addRequestControls( controls );
@@ -889,7 +890,7 @@ public class DefaultCoreSession implemen
         deleteContext.setLogChange( log );
 
         OperationManager operationManager = directoryService.getOperationManager();
-        
+
         try
         {
             operationManager.delete( deleteContext );
@@ -902,8 +903,8 @@ public class DefaultCoreSession implemen
 
         deleteRequest.getResultResponse().addAllControls( deleteContext.getResponseControls() );
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -920,7 +921,7 @@ public class DefaultCoreSession implemen
     {
         HasEntryOperationContext hasEntryContext = new HasEntryOperationContext( this, dn );
         OperationManager operationManager = directoryService.getOperationManager();
-        
+
         return operationManager.hasEntry( hasEntryContext );
     }
 
@@ -1090,7 +1091,7 @@ public class DefaultCoreSession implemen
     public void unbind() throws LdapException
     {
         UnbindOperationContext unbindContext = new UnbindOperationContext( this );
-        
+
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.unbind( unbindContext );
     }
@@ -1102,7 +1103,7 @@ public class DefaultCoreSession implemen
     public void unbind( UnbindRequest unbindRequest ) throws LdapException
     {
         UnbindOperationContext unbindContext = new UnbindOperationContext( this, unbindRequest );
-        
+
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.unbind( unbindContext );
     }

Modified: directory/apacheds/branches/apacheds-txns/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java?rev=1226758&r1=1226757&r2=1226758&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-txns/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java Tue Jan  3 12:34:59 2012
@@ -27,6 +27,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.filtering.BaseEntryFilteringCursor;
 import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
+import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.BindOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.CompareOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.DeleteOperationContext;
@@ -75,6 +76,7 @@ public class NormalizationInterceptor ex
     /** a filter node value normalizer and undefined node remover */
     private FilterNormalizingVisitor normVisitor;
 
+
     /**
      * Creates a new instance of a NormalizationInterceptor.
      */
@@ -82,7 +84,7 @@ public class NormalizationInterceptor ex
     {
         super( InterceptorEnum.NORMALIZATION_INTERCEPTOR );
     }
-    
+
 
     /**
      * Initialize the registries, normalizers.
@@ -112,6 +114,22 @@ public class NormalizationInterceptor ex
     /**
      * {@inheritDoc}
      */
+    public void add( AddOperationContext addContext ) throws LdapException
+    {
+        Entry entry = addContext.getEntry();
+
+        if ( !entry.isSchemaAware() )
+        {
+            entry.apply( schemaManager );
+        }
+
+        next( addContext );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
     public void bind( BindOperationContext bindContext ) throws LdapException
     {
         bindContext.getDn().apply( schemaManager );

Modified: directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/LdapRequestHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/LdapRequestHandler.java?rev=1226758&r1=1226757&r2=1226758&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/LdapRequestHandler.java (original)
+++ directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/LdapRequestHandler.java Tue Jan  3 12:34:59 2012
@@ -65,8 +65,8 @@ public abstract class LdapRequestHandler
 
     /** Txn Manager */
     protected TxnManager txnManager;
-    
-    
+
+
     /**
      * @return The associated ldap server instance
      */
@@ -83,9 +83,9 @@ public abstract class LdapRequestHandler
     public final void setLdapServer( LdapServer ldapServer )
     {
         this.ldapServer = ldapServer;
-        
+
         DirectoryService service = ldapServer.getDirectoryService();
-        
+
         if ( service != null )
         {
             txnManager = ldapServer.getDirectoryService().getTxnManager();
@@ -257,6 +257,7 @@ public abstract class LdapRequestHandler
          * Set the result code or guess the best option.
          */
         ResultCodeEnum code;
+
         if ( e instanceof LdapOperationException )
         {
             code = ( ( LdapOperationException ) e ).getResultCode();
@@ -284,7 +285,7 @@ public abstract class LdapRequestHandler
 
         result.setDiagnosticMessage( msg );
 
-        if ( e instanceof LdapOperationException)
+        if ( e instanceof LdapOperationException )
         {
             LdapOperationException ne = ( LdapOperationException ) e;
 
@@ -294,7 +295,7 @@ public abstract class LdapRequestHandler
 
             if ( ( ne.getResolvedDn() != null ) && setMatchedDn )
             {
-                result.setMatchedDn( (Dn) ne.getResolvedDn() );
+                result.setMatchedDn( ( Dn ) ne.getResolvedDn() );
             }
 
             // Add the referrals if necessary
@@ -304,7 +305,7 @@ public abstract class LdapRequestHandler
 
                 do
                 {
-                    String ref = ( (LdapReferralException) e ).getReferralInfo();
+                    String ref = ( ( LdapReferralException ) e ).getReferralInfo();
                     referrals.addLdapUrl( ref );
                 }
                 while ( ( ( LdapReferralException ) e ).skipReferral() );