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/02/10 16:13:05 UTC

svn commit: r1242812 - in /directory: apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/ shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/ shared/trunk/ldap/net/mina/src/main/java/org/apache/di...

Author: elecharny
Date: Fri Feb 10 15:13:05 2012
New Revision: 1242812

URL: http://svn.apache.org/viewvc?rev=1242812&view=rev
Log:
Used the constants created in LdapDecoder for the dapSession's attribute

Modified:
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java
    directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/LdapDecoderTest.java
    directory/shared/trunk/ldap/net/mina/src/main/java/org/apache/directory/shared/ldap/codec/protocol/mina/LdapProtocolDecoder.java

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java?rev=1242812&r1=1242811&r2=1242812&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java Fri Feb 10 15:13:05 2012
@@ -21,6 +21,7 @@ package org.apache.directory.server.ldap
 
 
 import org.apache.directory.shared.ldap.codec.api.LdapApiServiceFactory;
+import org.apache.directory.shared.ldap.codec.api.LdapDecoder;
 import org.apache.directory.shared.ldap.codec.api.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.api.MessageDecorator;
 import org.apache.directory.shared.ldap.codec.api.SchemaBinaryAttributeDetector;
@@ -83,7 +84,7 @@ class LdapProtocolHandler extends Demuxi
         ldapServer.getLdapSessionManager().addLdapSession( ldapSession );
 
         // Now, we have to store the DirectoryService instance into the session
-        session.setAttribute( "maxPDUSize", ldapServer.getDirectoryService().getMaxPDUSize() );
+        session.setAttribute( LdapDecoder.MAX_PDU_SIZE_ATTR, ldapServer.getDirectoryService().getMaxPDUSize() );
 
         // Last, store the message container
         LdapMessageContainer<? extends MessageDecorator<Message>> ldapMessageContainer =
@@ -92,7 +93,7 @@ class LdapProtocolHandler extends Demuxi
                 new SchemaBinaryAttributeDetector(
                     ldapServer.getDirectoryService().getSchemaManager() ) );
 
-        session.setAttribute( "messageContainer", ldapMessageContainer );
+        session.setAttribute( LdapDecoder.MESSAGE_CONTAINER_ATTR, ldapMessageContainer );
     }
 
 

Modified: directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/LdapDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/LdapDecoderTest.java?rev=1242812&r1=1242811&r2=1242812&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/LdapDecoderTest.java (original)
+++ directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/LdapDecoderTest.java Fri Feb 10 15:13:05 2012
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ * 
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ * 
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ * 
  */
 package org.apache.directory.shared.ldap.codec;
 
@@ -73,7 +73,7 @@ public class LdapDecoderTest extends Abs
 
 
     /**
-     * Decode an incoming buffer into LDAP messages. The result can be 0, 1 or many 
+     * Decode an incoming buffer into LDAP messages. The result can be 0, 1 or many
      * LDAP messages, which will be stored into the array the caller has created.
      * 
      * @param buffer The incoming byte buffer
@@ -233,7 +233,7 @@ public class LdapDecoderTest extends Abs
             new LdapMessageContainer<MessageDecorator<? extends Message>>( codec );
 
         IoSession dummySession = new DummySession();
-        dummySession.setAttribute( "messageContainer", container );
+        dummySession.setAttribute( LdapDecoder.MESSAGE_CONTAINER_ATTR, container );
 
         ByteBuffer stream = ByteBuffer.allocate( 0x6A );
         stream.put( new byte[]
@@ -815,7 +815,7 @@ public class LdapDecoderTest extends Abs
      * Test the decoding of a split Length.
      * 
      * The length is 3 bytes long, but the PDU has been split
-     * just after the first byte 
+     * just after the first byte
      */
     @Test
     public void testDecodeSplittedLength()

Modified: directory/shared/trunk/ldap/net/mina/src/main/java/org/apache/directory/shared/ldap/codec/protocol/mina/LdapProtocolDecoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/net/mina/src/main/java/org/apache/directory/shared/ldap/codec/protocol/mina/LdapProtocolDecoder.java?rev=1242812&r1=1242811&r2=1242812&view=diff
==============================================================================
--- directory/shared/trunk/ldap/net/mina/src/main/java/org/apache/directory/shared/ldap/codec/protocol/mina/LdapProtocolDecoder.java (original)
+++ directory/shared/trunk/ldap/net/mina/src/main/java/org/apache/directory/shared/ldap/codec/protocol/mina/LdapProtocolDecoder.java Fri Feb 10 15:13:05 2012
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ * 
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ * 
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ * 
  */
 package org.apache.directory.shared.ldap.codec.protocol.mina;
 
@@ -51,7 +51,7 @@ public class LdapProtocolDecoder impleme
 {
     /** The logger */
     private static Logger LOG = LoggerFactory.getLogger( LdapDecoder.class );
-
+    
     /** A speedup for logger */
     private static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
@@ -78,11 +78,11 @@ public class LdapProtocolDecoder impleme
         @SuppressWarnings("unchecked")
         LdapMessageContainer<MessageDecorator<? extends Message>> messageContainer =
             ( LdapMessageContainer<MessageDecorator<? extends Message>> )
-            session.getAttribute( "messageContainer" );
+            session.getAttribute( LdapDecoder.MESSAGE_CONTAINER_ATTR );
 
-        if ( session.containsAttribute( "maxPDUSize" ) )
+        if ( session.containsAttribute( LdapDecoder.MAX_PDU_SIZE_ATTR ) )
         {
-            int maxPDUSize = ( Integer ) session.getAttribute( "maxPDUSize" );
+            int maxPDUSize = ( Integer ) session.getAttribute( LdapDecoder.MAX_PDU_SIZE_ATTR );
 
             messageContainer.setMaxPDUSize( maxPDUSize );
         }
@@ -100,7 +100,7 @@ public class LdapProtocolDecoder impleme
 
 
     /**
-     * Decode an incoming buffer into LDAP messages. The result can be 0, 1 or many 
+     * Decode an incoming buffer into LDAP messages. The result can be 0, 1 or many
      * LDAP messages, which will be stored into the array the caller has created.
      * 
      * @param buffer The incoming byte buffer