directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r983534 [1/3] - in /directory: apacheds/branches/apacheds-codec-merge/server-integ/src/test/java/org/apache/directory/server/operations/add/ shared/branches/shared-codec-merge/asn1/src/main/java/org/apache/directory/shared/asn1/codec/statef...
Date Mon, 09 Aug 2010 06:42:25 GMT
Author: elecharny
Date: Mon Aug  9 06:41:54 2010
New Revision: 983534

URL: http://svn.apache.org/viewvc?rev=983534&view=rev
Log:
o Merged the DelRequestCodec, CompareRequestCodec, AbandonRequestCodec and UnbindRequestCodec with the Internal messages
o Added a ControlEnum class to list all the existing Controls
o Fixed the tests accordingly to the modifications

Added:
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlEnum.java
Modified:
    directory/apacheds/branches/apacheds-codec-merge/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java
    directory/shared/branches/shared-codec-merge/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/DecoderCallback.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapDecoder.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapTransformer.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlValueAction.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlsInitAction.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalAbstractMessage.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalMessage.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/LdapControlTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/LdapMessageTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/abandon/AbandonRequestTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/add/AddRequestTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/compare/CompareRequestTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/del/DelRequestTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/unbind/UnBindRequestTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/AddRequestImplTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/BindRequestImplTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/CompareRequestImplTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/DeleteRequestImplTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/ExtendedRequestImplTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/ExtendedResponseImplTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModifyDnRequestImplTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModifyRequestImplTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseDoneImplTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseReferenceImplTest.java

Modified: directory/apacheds/branches/apacheds-codec-merge/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java?rev=983534&r1=983533&r2=983534&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java Mon Aug  9 06:41:54 2010
@@ -100,84 +100,46 @@ import org.slf4j.LoggerFactory;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-@RunWith ( FrameworkRunner.class )
-@CreateDS( allowAnonAccess=true, name="AddIT-class",
-    partitions =
-        {
-            @CreatePartition(
-                name = "example",
-                suffix = "dc=example,dc=com",
-                contextEntry = @ContextEntry( 
-                    entryLdif =
-                        "dn: dc=example,dc=com\n" +
-                        "dc: example\n" +
-                        "objectClass: top\n" +
-                        "objectClass: domain\n\n" ),
-                indexes = 
-                {
-                    @CreateIndex( attribute = "objectClass" ),
-                    @CreateIndex( attribute = "dc" ),
-                    @CreateIndex( attribute = "ou" )
-                } ),
-                
-            @CreatePartition(
-                name = "directory",
-                suffix = "dc=directory,dc=apache,dc=org",
-                contextEntry = @ContextEntry( 
-                    entryLdif =
-                        "dn: dc=directory,dc=apache,dc=org\n"+
-                        "dc: directory\n"+
-                        "objectClass: top\n"+
-                        "objectClass: domain\n\n" ),
-                indexes = 
-                {
-                    @CreateIndex( attribute = "objectClass" ),
-                    @CreateIndex( attribute = "dc" ),
-                    @CreateIndex( attribute = "ou" )
-                } )    
-        })
-@CreateLdapServer ( 
-    transports = 
-    {
-        @CreateTransport( protocol = "LDAP" )
-    })
-@ApplyLdifs( {
-    // Entry # 0
-    "dn: cn=The Person,ou=system",
-    "objectClass: person",
-    "objectClass: top",
-    "cn: The Person",
-    "description: this is a person",
-    "sn: Person", 
-    
-    // Entry # 1
-    "dn: uid=akarasulu,ou=users,ou=system",
-    "objectClass: uidObject",
-    "objectClass: person",
-    "objectClass: top",
-    "uid: akarasulu",
-    "cn: Alex Karasulu",
-    "sn: karasulu", 
-    
-    // Entry # 2
-    "dn: ou=Computers,uid=akarasulu,ou=users,ou=system",
-    "objectClass: organizationalUnit",
-    "objectClass: top",
-    "ou: computers",
-    "description: Computers for Alex",
-    "seeAlso: ou=Machines,uid=akarasulu,ou=users,ou=system", 
-    
-    // Entry # 3
-    "dn: uid=akarasuluref,ou=users,ou=system",
-    "objectClass: uidObject",
-    "objectClass: referral",
-    "objectClass: top",
-    "uid: akarasuluref",
-    "ref: ldap://localhost:10389/uid=akarasulu,ou=users,ou=system",
-    "ref: ldap://foo:10389/uid=akarasulu,ou=users,ou=system",
-    "ref: ldap://bar:10389/uid=akarasulu,ou=users,ou=system"
-    }
-)
+@RunWith(FrameworkRunner.class)
+@CreateDS(allowAnonAccess = true, name = "AddIT-class", partitions =
+    {
+        @CreatePartition(name = "example", suffix = "dc=example,dc=com", contextEntry = @ContextEntry(entryLdif = "dn: dc=example,dc=com\n"
+            + "dc: example\n" + "objectClass: top\n" + "objectClass: domain\n\n"), indexes =
+            { @CreateIndex(attribute = "objectClass"), @CreateIndex(attribute = "dc"), @CreateIndex(attribute = "ou") }),
+
+        @CreatePartition(name = "directory", suffix = "dc=directory,dc=apache,dc=org", contextEntry = @ContextEntry(entryLdif = "dn: dc=directory,dc=apache,dc=org\n"
+            + "dc: directory\n" + "objectClass: top\n" + "objectClass: domain\n\n"), indexes =
+            { @CreateIndex(attribute = "objectClass"), @CreateIndex(attribute = "dc"), @CreateIndex(attribute = "ou") }) })
+@CreateLdapServer(transports =
+    { @CreateTransport(protocol = "LDAP") })
+@ApplyLdifs(
+    {
+        // Entry # 0
+        "dn: cn=The Person,ou=system",
+        "objectClass: person",
+        "objectClass: top",
+        "cn: The Person",
+        "description: this is a person",
+        "sn: Person",
+
+        // Entry # 1
+        "dn: uid=akarasulu,ou=users,ou=system", "objectClass: uidObject", "objectClass: person",
+        "objectClass: top",
+        "uid: akarasulu",
+        "cn: Alex Karasulu",
+        "sn: karasulu",
+
+        // Entry # 2
+        "dn: ou=Computers,uid=akarasulu,ou=users,ou=system", "objectClass: organizationalUnit", "objectClass: top",
+        "ou: computers",
+        "description: Computers for Alex",
+        "seeAlso: ou=Machines,uid=akarasulu,ou=users,ou=system",
+
+        // Entry # 3
+        "dn: uid=akarasuluref,ou=users,ou=system", "objectClass: uidObject", "objectClass: referral",
+        "objectClass: top", "uid: akarasuluref", "ref: ldap://localhost:10389/uid=akarasulu,ou=users,ou=system",
+        "ref: ldap://foo:10389/uid=akarasulu,ou=users,ou=system",
+        "ref: ldap://bar:10389/uid=akarasulu,ou=users,ou=system" })
 public class AddIT extends AbstractLdapTestUnit
 {
     private static final Logger LOG = LoggerFactory.getLogger( AddIT.class );
@@ -186,7 +148,8 @@ public class AddIT extends AbstractLdapT
     private static final String BASE = "ou=system";
     private static final String BASE_EXAMPLE_COM = "dc=example,dc=com";
     private static final String BASE_DIRECTORY_APACHE_ORG = "dc=directory,dc=apache,dc=org";
-    
+
+
     /**
      * This is the original defect as in JIRA DIREVE-216.
      * 
@@ -198,8 +161,7 @@ public class AddIT extends AbstractLdapT
         DirContext ctx = ( DirContext ) getWiredContext( ldapServer ).lookup( BASE );
 
         // modify object classes, add two more
-        Attributes attributes = LdifUtils.createAttributes( 
-            "objectClass: organizationalPerson",
+        Attributes attributes = LdifUtils.createAttributes( "objectClass: organizationalPerson",
             "objectClass: inetOrgPerson" );
 
         DirContext person = ( DirContext ) ctx.lookup( RDN );
@@ -210,7 +172,8 @@ public class AddIT extends AbstractLdapT
         attributes = person.getAttributes( "" );
         Attribute newOcls = attributes.get( "objectClass" );
 
-        String[] expectedOcls = { "top", "person", "organizationalPerson", "inetOrgPerson" };
+        String[] expectedOcls =
+            { "top", "person", "organizationalPerson", "inetOrgPerson" };
 
         for ( String name : expectedOcls )
         {
@@ -276,8 +239,8 @@ public class AddIT extends AbstractLdapT
             // expected
         }
     }
-    
-    
+
+
     /**
      * Test case to demonstrate DIRSERVER-643 ("Netscape SDK: Adding an entry with
      * two description attributes does not combine values."). Uses Sun ONE Directory
@@ -289,7 +252,7 @@ public class AddIT extends AbstractLdapT
     public void testAddEntryWithTwoDescriptions() throws Exception
     {
         LdapConnection con = getClientApiConnection( ldapServer );
-        
+
         String dn = "cn=Kate Bush," + BASE;
         Entry kate = new DefaultEntry( new DN( dn ) );
 
@@ -346,7 +309,7 @@ public class AddIT extends AbstractLdapT
         con.add( kate );
 
         // Analyze entry and description attribute
-        Entry kateReloaded = ( (SearchResultEntry ) con.lookup( dn ) ).getEntry();
+        Entry kateReloaded = ( ( SearchResultEntry ) con.lookup( dn ) ).getEntry();
         assertNotNull( kateReloaded );
         EntryAttribute attr = kateReloaded.get( "description" );
         assertNotNull( attr );
@@ -372,7 +335,7 @@ public class AddIT extends AbstractLdapT
 
         String dn = "cn=Kate Bush," + BASE;
         Entry kate = new DefaultEntry( new DN( dn ) );
-        
+
         kate.add( "objectclass", "top", "person" );
         kate.add( "sn", "Bush" );
 
@@ -398,7 +361,7 @@ public class AddIT extends AbstractLdapT
         con.unBind();
     }
 
-    
+
     /**
      * Try to add entry with invalid number of values for a single-valued attribute
      * 
@@ -409,7 +372,7 @@ public class AddIT extends AbstractLdapT
     public void testAddWithInvalidNumberOfAttributeValues() throws Exception
     {
         DirContext ctx = ( DirContext ) getWiredContext( ldapServer ).lookup( BASE );
-        
+
         // add inetOrgPerson with two displayNames
         Attributes attrs = new BasicAttributes( true );
         Attribute ocls = new BasicAttribute( "objectClass" );
@@ -545,7 +508,7 @@ public class AddIT extends AbstractLdapT
         sr = ne.next();
         assertEquals( "ou=favorite", sr.getName() );
         assertFalse( ne.hasMore() );
-        
+
         // search with base set to alias and dereferencing turned on
         controls = new SearchControls();
         controls.setDerefLinkFlag( false );
@@ -554,9 +517,9 @@ public class AddIT extends AbstractLdapT
         ne = containerCtx.search( "ou=bestFruit", "(objectClass=*)", controls );
         assertTrue( ne.hasMore() );
         sr = ne.next();
-        assertEquals( "ldap://localhost:"+ ldapServer.getPort() +"/ou=favorite,ou=Fruits,ou=system", sr.getName() );
+        assertEquals( "ldap://localhost:" + ldapServer.getPort() + "/ou=favorite,ou=Fruits,ou=system", sr.getName() );
         assertFalse( ne.hasMore() );
-        
+
         // Remove alias and entry
         containerCtx.destroySubcontext( rdnAlias );
         containerCtx.destroySubcontext( entryRdn );
@@ -564,8 +527,8 @@ public class AddIT extends AbstractLdapT
         // Remove container
         ctx.destroySubcontext( containerRdn );
     }
-    
-    
+
+
     /**
      * Try to add entry and an alias to it. Afterwards, remove it.  Taken from
      * DIRSERVER-1157 test contribution.
@@ -704,13 +667,13 @@ public class AddIT extends AbstractLdapT
         constraints.setClientControls( new LDAPControl( LDAPControl.MANAGEDSAIT, true, new byte[0] ) );
         constraints.setServerControls( new LDAPControl( LDAPControl.MANAGEDSAIT, true, new byte[0] ) );
         conn.setConstraints( constraints );
-        
+
         // add success
         LDAPAttributeSet attrSet = new LDAPAttributeSet();
         attrSet.add( new LDAPAttribute( "objectClass", "organizationalUnit" ) );
         attrSet.add( new LDAPAttribute( "ou", "UnderReferral" ) );
         LDAPEntry entry = new LDAPEntry( "ou=UnderReferral,uid=akarasuluref,ou=users,ou=system", attrSet );
-        
+
         try
         {
             conn.add( entry, constraints );
@@ -718,57 +681,56 @@ public class AddIT extends AbstractLdapT
         }
         catch ( LDAPException le )
         {
-            assertEquals( 10, le.getLDAPResultCode() );
+            assertEquals( ResultCodeEnum.REFERRAL.getValue(), le.getLDAPResultCode() );
         }
-        
+
         try
         {
-            conn.read( "ou=UnderReferral,uid=akarasuluref,ou=users,ou=system", 
-                ( LDAPSearchConstraints ) constraints );
+            conn.read( "ou=UnderReferral,uid=akarasuluref,ou=users,ou=system", ( LDAPSearchConstraints ) constraints );
             fail();
         }
         catch ( LDAPException le )
         {
-            
+
         }
-        
+
         conn.disconnect();
     }
-    
-    
-    public static LdapContext getContext( String principalDn, DirectoryService service, String dn )
-    throws Exception
+
+
+    public static LdapContext getContext( String principalDn, DirectoryService service, String dn ) throws Exception
     {
         if ( principalDn == null )
         {
             principalDn = "";
         }
-        
+
         DN userDn = new DN( principalDn, service.getSchemaManager() );
         LdapPrincipal principal = new LdapPrincipal( userDn, AuthenticationLevel.SIMPLE );
-        
+
         if ( dn == null )
         {
             dn = "";
         }
-        
+
         CoreSession session = service.getSession( principal );
         LdapContext ctx = new ServerLdapContext( service, session, new LdapName( dn ) );
         return ctx;
     }
-    
-    
+
+
     /**
      * Tests add operation on referral entry with the ManageDsaIT control.
      */
     @Test
     public void testOnReferralWitJNDIIgnore() throws Exception
     {
-        LdapContext MNNCtx = getContext( ServerDNConstants.ADMIN_SYSTEM_DN, ldapServer.getDirectoryService(), "uid=akarasuluref,ou=users,ou=system" );
+        LdapContext MNNCtx = getContext( ServerDNConstants.ADMIN_SYSTEM_DN, ldapServer.getDirectoryService(),
+            "uid=akarasuluref,ou=users,ou=system" );
 
         // Set to 'ignore'
         MNNCtx.addToEnvironment( Context.REFERRAL, "ignore" );
-        
+
         try
         {
             // JNDI entry
@@ -785,12 +747,12 @@ public class AddIT extends AbstractLdapT
             assertTrue( true );
         }
     }
-    
-    
+
+
     /**
      * Tests referral handling when an ancestor is a referral.
      */
-    @Test 
+    @Test
     public void testAncestorReferral() throws Exception
     {
         LOG.debug( "" );
@@ -804,22 +766,22 @@ public class AddIT extends AbstractLdapT
         attrSet.add( new LDAPAttribute( "objectClass", "organizationalUnit" ) );
         attrSet.add( new LDAPAttribute( "ou", "UnderReferral" ) );
         LDAPEntry entry = new LDAPEntry( "ou=UnderReferral,ou=Computers,uid=akarasuluref,ou=users,ou=system", attrSet );
-        
+
         LDAPResponseListener listener = conn.add( entry, null, constraints );
         LDAPResponse response = listener.getResponse();
         assertEquals( ResultCodeEnum.REFERRAL.getValue(), response.getResultCode() );
 
-        assertEquals( "ldap://localhost:10389/ou=UnderReferral,ou=Computers,uid=akarasulu,ou=users,ou=system", 
-            response.getReferrals()[0] );
-        assertEquals( "ldap://foo:10389/ou=UnderReferral,ou=Computers,uid=akarasulu,ou=users,ou=system", 
-            response.getReferrals()[1] );
-        assertEquals( "ldap://bar:10389/ou=UnderReferral,ou=Computers,uid=akarasulu,ou=users,ou=system", 
-            response.getReferrals()[2] );
+        assertEquals( "ldap://localhost:10389/ou=UnderReferral,ou=Computers,uid=akarasulu,ou=users,ou=system", response
+            .getReferrals()[0] );
+        assertEquals( "ldap://foo:10389/ou=UnderReferral,ou=Computers,uid=akarasulu,ou=users,ou=system", response
+            .getReferrals()[1] );
+        assertEquals( "ldap://bar:10389/ou=UnderReferral,ou=Computers,uid=akarasulu,ou=users,ou=system", response
+            .getReferrals()[2] );
 
         conn.disconnect();
     }
 
-    
+
     /**
      * Tests add operation on normal and referral entries without the 
      * ManageDsaIT control. Referrals are sent back to the client with a
@@ -832,14 +794,14 @@ public class AddIT extends AbstractLdapT
         LDAPConstraints constraints = new LDAPConstraints();
         constraints.setReferrals( false );
         conn.setConstraints( constraints );
-        
+
         // referrals failure
 
         LDAPAttributeSet attrSet = new LDAPAttributeSet();
         attrSet.add( new LDAPAttribute( "objectClass", "organizationalUnit" ) );
         attrSet.add( new LDAPAttribute( "ou", "UnderReferral" ) );
         LDAPEntry entry = new LDAPEntry( "ou=UnderReferral,uid=akarasuluref,ou=users,ou=system", attrSet );
-        
+
         LDAPResponseListener listener = null;
         LDAPResponse response = null;
         listener = conn.add( entry, null, constraints );
@@ -847,14 +809,15 @@ public class AddIT extends AbstractLdapT
 
         assertEquals( ResultCodeEnum.REFERRAL.getValue(), response.getResultCode() );
 
-        assertEquals( "ldap://localhost:10389/ou=UnderReferral,uid=akarasulu,ou=users,ou=system", response.getReferrals()[0] );
+        assertEquals( "ldap://localhost:10389/ou=UnderReferral,uid=akarasulu,ou=users,ou=system", response
+            .getReferrals()[0] );
         assertEquals( "ldap://foo:10389/ou=UnderReferral,uid=akarasulu,ou=users,ou=system", response.getReferrals()[1] );
         assertEquals( "ldap://bar:10389/ou=UnderReferral,uid=akarasulu,ou=users,ou=system", response.getReferrals()[2] );
 
         conn.disconnect();
     }
-    
-    
+
+
     /**
      * Tests add operation on normal and referral entries without the 
      * ManageDsaIT control using JNDI instead of the Netscape API. Referrals 
@@ -867,19 +830,20 @@ public class AddIT extends AbstractLdapT
         SearchControls controls = new SearchControls();
         controls.setReturningAttributes( new String[0] );
         controls.setSearchScope( SearchControls.OBJECT_SCOPE );
-        
+
         // add failure
         Attributes attrs = new BasicAttributes( "objectClass", "organizationalUnit", true );
         attrs.put( "ou", "UnderReferral" );
-        
+
         try
         {
             ctx.createSubcontext( "ou=UnderReferral,uid=akarasuluref,ou=users,ou=system", attrs );
             fail( "Should never get here: add should fail with ReferralExcpetion" );
         }
-        catch( ReferralException e )
+        catch ( ReferralException e )
         {
-            assertEquals( "ldap://localhost:10389/ou=UnderReferral,uid=akarasulu,ou=users,ou=system", e.getReferralInfo() );
+            assertEquals( "ldap://localhost:10389/ou=UnderReferral,uid=akarasulu,ou=users,ou=system", e
+                .getReferralInfo() );
         }
 
         ctx.close();
@@ -902,7 +866,7 @@ public class AddIT extends AbstractLdapT
         attrs.put( "givenName", "Jim" );
         attrs.put( "sn", "Bean" );
         attrs.put( "cn", "\"Jim, Bean\"" );
-        
+
         ctx.createSubcontext( "cn=\"Jim, Bean\"", attrs );
     }
 
@@ -914,7 +878,7 @@ public class AddIT extends AbstractLdapT
     public void testAddEntryNoRDNInEntry() throws Exception
     {
         DirContext ctx = ( DirContext ) getWiredContext( ldapServer ).lookup( BASE );
-        
+
         // Create a person
         Attributes person = new BasicAttributes( "objectClass", "inetOrgPerson", true );
         person.get( "objectClass" ).add( "top" );
@@ -924,22 +888,23 @@ public class AddIT extends AbstractLdapT
         person.put( "cn", "Jackson" );
 
         DirContext michaelCtx = ctx.createSubcontext( "givenname=Michael", person );
-        
+
         assertNotNull( michaelCtx );
-        
+
         DirContext jackson = ( DirContext ) ctx.lookup( "givenname=Michael" );
         person = jackson.getAttributes( "" );
         Attribute newOcls = person.get( "objectClass" );
 
-        String[] expectedOcls = { "top", "person", "organizationalPerson", "inetOrgPerson" };
+        String[] expectedOcls =
+            { "top", "person", "organizationalPerson", "inetOrgPerson" };
 
         for ( String name : expectedOcls )
         {
             assertTrue( "object class " + name + " is present", newOcls.contains( name ) );
         }
-        
+
         Attribute givenName = person.get( "givenname" );
-        
+
         assertEquals( "Michael", givenName.get() );
     }
 
@@ -952,7 +917,7 @@ public class AddIT extends AbstractLdapT
     public void testAddEntryDifferentRDNInEntry() throws Exception
     {
         DirContext ctx = ( DirContext ) getWiredContext( ldapServer ).lookup( BASE );
-        
+
         // Create a person
         Attributes person = new BasicAttributes( "objectClass", "inetOrgPerson", true );
         person.get( "objectClass" ).add( "top" );
@@ -963,24 +928,26 @@ public class AddIT extends AbstractLdapT
         person.put( "cn", "Jackson" );
 
         DirContext michaelCtx = ctx.createSubcontext( "cn=Michael", person );
-        
+
         assertNotNull( michaelCtx );
-        
+
         DirContext jackson = ( DirContext ) ctx.lookup( "cn=Michael" );
         person = jackson.getAttributes( "" );
         Attribute newOcls = person.get( "objectClass" );
 
-        String[] expectedOcls = { "top", "person", "organizationalPerson", "inetOrgPerson" };
+        String[] expectedOcls =
+            { "top", "person", "organizationalPerson", "inetOrgPerson" };
 
         for ( String name : expectedOcls )
         {
             assertTrue( "object class " + name + " is present", newOcls.contains( name ) );
         }
-        
+
         Attribute cn = person.get( "cn" );
-        
+
         assertEquals( 2, cn.size() );
-        String[] expectedCns = { "Jackson", "Michael" };
+        String[] expectedCns =
+            { "Jackson", "Michael" };
 
         for ( String name : expectedCns )
         {
@@ -997,7 +964,7 @@ public class AddIT extends AbstractLdapT
     public void testAddEntryDifferentRDNSingleValuedInEntry() throws Exception
     {
         DirContext ctx = ( DirContext ) getWiredContext( ldapServer ).lookup( BASE );
-        
+
         // Create a person
         Attributes person = new BasicAttributes( "objectClass", "inetOrgPerson", true );
         person.get( "objectClass" ).add( "top" );
@@ -1008,23 +975,24 @@ public class AddIT extends AbstractLdapT
         person.put( "cn", "Jackson" );
 
         DirContext michaelCtx = ctx.createSubcontext( "displayName=test", person );
-        
+
         assertNotNull( michaelCtx );
-        
+
         DirContext jackson = ( DirContext ) ctx.lookup( "displayName=test" );
         person = jackson.getAttributes( "" );
         Attribute newOcls = person.get( "objectClass" );
 
-        String[] expectedOcls = { "top", "person", "organizationalPerson", "inetOrgPerson" };
+        String[] expectedOcls =
+            { "top", "person", "organizationalPerson", "inetOrgPerson" };
 
         for ( String name : expectedOcls )
         {
             assertTrue( "object class " + name + " is present", newOcls.contains( name ) );
         }
-        
+
         // Check that the displayName attribute has been replaced
         Attribute displayName = person.get( "displayName" );
-        
+
         assertEquals( 1, displayName.size() );
         assertTrue( displayName.contains( "test" ) );
     }
@@ -1038,7 +1006,7 @@ public class AddIT extends AbstractLdapT
     public void testAddEntryComposedRDN() throws Exception
     {
         DirContext ctx = ( DirContext ) getWiredContext( ldapServer ).lookup( BASE );
-        
+
         // Create a person
         Attributes person = new BasicAttributes( "objectClass", "inetOrgPerson", true );
         person.get( "objectClass" ).add( "top" );
@@ -1048,29 +1016,30 @@ public class AddIT extends AbstractLdapT
         person.put( "cn", "Jackson" );
 
         DirContext michaelCtx = ctx.createSubcontext( "displayName=test+cn=Michael", person );
-        
+
         assertNotNull( michaelCtx );
-        
+
         DirContext jackson = ( DirContext ) ctx.lookup( "displayName=test+cn=Michael" );
         person = jackson.getAttributes( "" );
         Attribute newOcls = person.get( "objectClass" );
 
-        String[] expectedOcls = { "top", "person", "organizationalPerson", "inetOrgPerson" };
+        String[] expectedOcls =
+            { "top", "person", "organizationalPerson", "inetOrgPerson" };
 
         for ( String name : expectedOcls )
         {
             assertTrue( "object class " + name + " is present", newOcls.contains( name ) );
         }
-        
+
         // Check that the DIsplayName attribute has been added
         Attribute displayName = person.get( "displayName" );
-        
+
         assertEquals( 1, displayName.size() );
         assertTrue( displayName.contains( "test" ) );
 
         // Check that the cn attribute value has been added
         Attribute cn = person.get( "cn" );
-        
+
         assertEquals( 2, cn.size() );
         assertTrue( cn.contains( "Jackson" ) );
         assertTrue( cn.contains( "Michael" ) );
@@ -1093,20 +1062,20 @@ public class AddIT extends AbstractLdapT
         // modify object classes, add two more
         Attributes attributes = new BasicAttributes( true );
         Attribute ocls = new BasicAttribute( "description" );
-        
+
         // Inject a 1024 bytes long description
         StringBuilder sb = new StringBuilder();
-        
+
         for ( int i = 0; i < 128; i++ )
         {
             sb.append( "0123456789ABCDEF" );
         }
-        
+
         ocls.add( sb.toString() );
         attributes.put( ocls );
 
         DirContext person = ( DirContext ) ctx.lookup( RDN );
-        
+
         try
         {
             person.modifyAttributes( "", DirContext.ADD_ATTRIBUTE, attributes );
@@ -1116,14 +1085,14 @@ public class AddIT extends AbstractLdapT
         {
             // We are expecting the session to be close here.
         }
-        
+
         // Test again with a bigger size
         // Limit the PDU size to 1024
         ldapServer.getDirectoryService().setMaxPDUSize( 4096 );
-        
+
         ctx = ( DirContext ) getWiredContext( ldapServer ).lookup( BASE );
         person = ( DirContext ) ctx.lookup( RDN );
-        
+
         try
         {
             person.modifyAttributes( "", DirContext.ADD_ATTRIBUTE, attributes );
@@ -1137,7 +1106,7 @@ public class AddIT extends AbstractLdapT
         // Read again from directory
         ctx = ( DirContext ) getWiredContext( ldapServer ).lookup( BASE );
         person = ( DirContext ) ctx.lookup( RDN );
-        
+
         assertNotNull( person );
         attributes = person.getAttributes( "" );
         Attribute newOcls = attributes.get( "objectClass" );
@@ -1210,13 +1179,13 @@ public class AddIT extends AbstractLdapT
         assertTrue( userPasswordAttribute.contains( StringTools.getBytesUtf8( "ABC" ) ) );
         assertFalse( res.hasMore() );
     }
-    
-    
+
+
     @Test
     public void testAddEntryUUIDAndCSNAttributes() throws Exception
     {
         LdapConnection con = getClientApiConnection( ldapServer );
-        
+
         String dn = "cn=Kate Bush," + BASE;
         Entry entry = new DefaultEntry( new DN( dn ) );
         entry.add( "objectclass", "top", "person" );
@@ -1232,7 +1201,7 @@ public class AddIT extends AbstractLdapT
         CsnFactory csnFac = new CsnFactory( 0 );
         Csn csn = csnFac.newInstance();
         entry.add( SchemaConstants.ENTRY_CSN_AT, csn.toString() );
-        
+
         con.add( entry );
 
         // Analyze entry and description attribute
@@ -1242,19 +1211,19 @@ public class AddIT extends AbstractLdapT
 
         EntryAttribute attr = addedEntry.get( SchemaConstants.ENTRY_UUID_AT );
         assertNotNull( attr );
-        
+
         assertEquals( uuid.toString(), attr.getString() );
 
         attr = addedEntry.get( SchemaConstants.ENTRY_CSN_AT );
         assertNotNull( attr );
         assertEquals( csn.toString(), attr.getString() );
-        
+
         // Remove entry
         con.delete( dn );
         con.unBind();
     }
 
-    
+
     protected Attributes getPersonAttributes( String sn, String cn )
     {
         Attributes attrs = new BasicAttributes( true );
@@ -1281,7 +1250,6 @@ public class AddIT extends AbstractLdapT
         return attrs;
     }
 
-    
     /**
      * <pre>
      * ou=system

Modified: directory/shared/branches/shared-codec-merge/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/DecoderCallback.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/DecoderCallback.java?rev=983534&r1=983533&r2=983534&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/DecoderCallback.java (original)
+++ directory/shared/branches/shared-codec-merge/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/DecoderCallback.java Mon Aug  9 06:41:54 2010
@@ -30,10 +30,8 @@ public interface DecoderCallback
     /**
      * Callback to deliver a fully decoded object.
      * 
-     * @param decoder
-     *            the stateful decoder driving the callback
-     * @param decoded
-     *            the object that was decoded
+     * @param decoder the stateful decoder driving the callback
+     * @param decoded the object that was decoded
      */
     void decodeOccurred( StatefulDecoder decoder, Object decoded );
 }

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapDecoder.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapDecoder.java?rev=983534&r1=983533&r2=983534&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapDecoder.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapDecoder.java Mon Aug  9 06:41:54 2010
@@ -76,7 +76,7 @@ public class LdapDecoder implements Prov
         this.provider = provider;
         ldapMessageContainer = new LdapMessageContainer( binaryAttributeDetector );
         ldapDecoder = new Asn1Decoder();
-        
+
         ldapMessageContainer.setMaxPDUSize( maxPDUSize );
     }
 
@@ -110,23 +110,23 @@ public class LdapDecoder implements Prov
             try
             {
                 ldapDecoder.decode( buf, ldapMessageContainer );
-    
+
                 if ( IS_DEBUG )
                 {
                     log.debug( "Decoding the PDU : " );
-    
+
                     int size = buf.position();
                     buf.flip();
-                    
-                    byte[] array = new byte[ size - position ];
-                    
+
+                    byte[] array = new byte[size - position];
+
                     for ( int i = position; i < size; i++ )
                     {
-                        array[ i ] = buf.get();
+                        array[i] = buf.get();
                     }
-    
+
                     position = size;
-                    
+
                     if ( array.length == 0 )
                     {
                         log.debug( "NULL buffer, what the HELL ???" );
@@ -136,7 +136,7 @@ public class LdapDecoder implements Prov
                         log.debug( StringTools.dumpBytes( array ) );
                     }
                 }
-                
+
                 if ( ldapMessageContainer.getState() == TLVStateEnum.PDU_DECODED )
                 {
                     if ( IS_DEBUG )
@@ -144,8 +144,15 @@ public class LdapDecoder implements Prov
                         log.debug( "Decoded LdapMessage : " + ldapMessageContainer.getLdapMessage() );
                         buf.mark();
                     }
-    
-                    decoderCallback.decodeOccurred( null, ldapMessageContainer.getLdapMessage() );
+
+                    if ( ldapMessageContainer.isInternal() )
+                    {
+                        decoderCallback.decodeOccurred( null, ldapMessageContainer.getInternalMessage() );
+                    }
+                    else
+                    {
+                        decoderCallback.decodeOccurred( null, ldapMessageContainer.getLdapMessage() );
+                    }
                     ldapMessageContainer.clean();
                 }
             }

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java?rev=983534&r1=983533&r2=983534&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java Mon Aug  9 06:41:54 2010
@@ -43,8 +43,12 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.search.SearchResultEntryCodec;
 import org.apache.directory.shared.ldap.codec.search.SearchResultReferenceCodec;
 import org.apache.directory.shared.ldap.codec.unbind.UnBindRequestCodec;
+import org.apache.directory.shared.ldap.message.internal.InternalAbandonRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalAddRequest;
+import org.apache.directory.shared.ldap.message.internal.InternalCompareRequest;
+import org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalMessage;
+import org.apache.directory.shared.ldap.message.internal.InternalUnbindRequest;
 import org.apache.directory.shared.ldap.message.spi.BinaryAttributeDetector;
 
 
@@ -71,10 +75,11 @@ public class LdapMessageContainer extend
 
     /** The message ID */
     private int messageId;
-    
+
     /** The current control */
     private AbstractControl currentControl;
 
+
     // ~ Constructors
     // -------------------------------------------------------------------------------
 
@@ -86,11 +91,11 @@ public class LdapMessageContainer extend
     {
         this( new BinaryAttributeDetector()
         {
-            public boolean isBinary( String attributeId ) 
+            public boolean isBinary( String attributeId )
             {
                 return false;
             }
-        });
+        } );
     }
 
 
@@ -120,7 +125,7 @@ public class LdapMessageContainer extend
         return ldapMessage;
     }
 
-    
+
     /**
      * @return Returns the ldapMessage.
      */
@@ -129,214 +134,250 @@ public class LdapMessageContainer extend
         return internalMessage;
     }
 
-    
+
     /**
      * @return Returns the LdapResponse.
      */
     public LdapResponseCodec getLdapResponse()
     {
-        return (LdapResponseCodec)ldapMessage;
+        return ( LdapResponseCodec ) ldapMessage;
     }
 
-    
+
     /**
      * @return Returns the AbandonRequest stored in the container
      */
     public AbandonRequestCodec getAbandonRequest()
     {
-        return (AbandonRequestCodec)ldapMessage;
+        return ( AbandonRequestCodec ) ldapMessage;
+    }
+
+
+    /**
+     * @return Returns the AbandonRequest stored in the container
+     */
+    public InternalAbandonRequest getInternalAbandonRequest()
+    {
+        return ( InternalAbandonRequest ) internalMessage;
     }
 
-    
+
     /**
      * @return Returns the AddRequest stored in the container
      */
     public AddRequestCodec getAddRequest()
     {
-        return (AddRequestCodec)ldapMessage;
+        return ( AddRequestCodec ) ldapMessage;
     }
 
-    
+
     /**
      * @return Returns the InternalAddRequest stored in the container
      */
     public InternalAddRequest getInternalAddRequest()
     {
-        return (InternalAddRequest)internalMessage;
+        return ( InternalAddRequest ) internalMessage;
     }
 
-    
+
     /**
      * @return Returns the AddResponse stored in the container
      */
     public AddResponseCodec getAddResponse()
     {
-        return (AddResponseCodec)ldapMessage;
+        return ( AddResponseCodec ) ldapMessage;
     }
 
-    
+
     /**
      * @return Returns the BindRequest stored in the container
      */
     public BindRequestCodec getBindRequest()
     {
-        return (BindRequestCodec)ldapMessage;
+        return ( BindRequestCodec ) ldapMessage;
     }
 
-    
+
     /**
      * @return Returns the BindResponse stored in the container
      */
     public BindResponseCodec getBindResponse()
     {
-        return (BindResponseCodec)ldapMessage;
+        return ( BindResponseCodec ) ldapMessage;
     }
 
-    
+
     /**
      * @return Returns the CompareRequest stored in the container
      */
     public CompareRequestCodec getCompareRequest()
     {
-        return (CompareRequestCodec)ldapMessage;
+        return ( CompareRequestCodec ) ldapMessage;
+    }
+
+
+    /**
+     * @return Returns the CompareRequest stored in the container
+     */
+    public InternalCompareRequest getInternalCompareRequest()
+    {
+        return ( InternalCompareRequest ) internalMessage;
     }
 
-    
+
     /**
      * @return Returns the CompareResponse stored in the container
      */
     public CompareResponseCodec getCompareResponse()
     {
-        return (CompareResponseCodec)ldapMessage;
+        return ( CompareResponseCodec ) ldapMessage;
     }
 
-    
+
     /**
      * @return Returns the DelRequest stored in the container
      */
     public DelRequestCodec getDelRequest()
     {
-        return (DelRequestCodec)ldapMessage;
+        return ( DelRequestCodec ) ldapMessage;
     }
 
-    
+
+    /**
+     * @return Returns the InternalDeleleteRequest stored in the container
+     */
+    public InternalDeleteRequest getInternalDeleteRequest()
+    {
+        return ( InternalDeleteRequest ) internalMessage;
+    }
+
+
     /**
      * @return Returns the DelResponse stored in the container
      */
     public DelResponseCodec getDelResponse()
     {
-        return (DelResponseCodec)ldapMessage;
+        return ( DelResponseCodec ) ldapMessage;
     }
 
-    
+
     /**
      * @return Returns the ExtendedRequest stored in the container
      */
     public ExtendedRequestCodec getExtendedRequest()
     {
-        return (ExtendedRequestCodec)ldapMessage;
+        return ( ExtendedRequestCodec ) ldapMessage;
     }
 
-    
+
     /**
      * @return Returns the ExtendedResponse stored in the container
      */
     public ExtendedResponseCodec getExtendedResponse()
     {
-        return (ExtendedResponseCodec)ldapMessage;
+        return ( ExtendedResponseCodec ) ldapMessage;
     }
 
-    
+
     /**
      * @return Returns the IntermediateResponse stored in the container
      */
     public IntermediateResponseCodec getIntermediateResponse()
     {
-        return (IntermediateResponseCodec)ldapMessage;
+        return ( IntermediateResponseCodec ) ldapMessage;
     }
 
-    
+
     /**
      * @return Returns the ModifyRequest stored in the container
      */
     public ModifyRequestCodec getModifyRequest()
     {
-        return (ModifyRequestCodec)ldapMessage;
+        return ( ModifyRequestCodec ) ldapMessage;
     }
 
-    
+
     /**
      * @return Returns the ModifyResponse stored in the container
      */
     public ModifyResponseCodec getModifyResponse()
     {
-        return (ModifyResponseCodec)ldapMessage;
+        return ( ModifyResponseCodec ) ldapMessage;
     }
 
-    
+
     /**
      * @return Returns the ModifyDnRequest stored in the container
      */
     public ModifyDNRequestCodec getModifyDnRequest()
     {
-        return (ModifyDNRequestCodec)ldapMessage;
+        return ( ModifyDNRequestCodec ) ldapMessage;
     }
 
-    
+
     /**
      * @return Returns the ModifyDnResponse stored in the container
      */
     public ModifyDNResponseCodec getModifyDnResponse()
     {
-        return (ModifyDNResponseCodec)ldapMessage;
+        return ( ModifyDNResponseCodec ) ldapMessage;
     }
 
-    
+
     /**
      * @return Returns the SearchRequest stored in the container
      */
     public SearchRequestCodec getSearchRequest()
     {
-        return (SearchRequestCodec)ldapMessage;
+        return ( SearchRequestCodec ) ldapMessage;
     }
 
-    
+
     /**
      * @return Returns the SearchResultEntryCodec stored in the container
      */
     public SearchResultEntryCodec getSearchResultEntry()
     {
-        return (SearchResultEntryCodec)ldapMessage;
+        return ( SearchResultEntryCodec ) ldapMessage;
     }
 
-    
+
     /**
      * @return Returns the SearchResultReferenceCodec stored in the container
      */
     public SearchResultReferenceCodec getSearchResultReference()
     {
-        return (SearchResultReferenceCodec)ldapMessage;
+        return ( SearchResultReferenceCodec ) ldapMessage;
     }
 
-    
+
     /**
      * @return Returns the SearchResultDone stored in the container
      */
     public SearchResultDoneCodec getSearchResultDone()
     {
-        return (SearchResultDoneCodec)ldapMessage;
+        return ( SearchResultDoneCodec ) ldapMessage;
     }
 
-    
+
     /**
      * @return Returns the UnbindRequest stored in the container
      */
     public UnBindRequestCodec getUnbindRequest()
     {
-        return (UnBindRequestCodec)ldapMessage;
+        return ( UnBindRequestCodec ) ldapMessage;
     }
 
-    
+
+    /**
+     * @return Returns the UnbindRequest stored in the container
+     */
+    public InternalUnbindRequest getInternalUnbindRequest()
+    {
+        return ( InternalUnbindRequest ) internalMessage;
+    }
+
+
     /**
      * Set a ldapMessage Object into the container. It will be completed by the
      * ldapDecoder .
@@ -348,7 +389,7 @@ public class LdapMessageContainer extend
         this.ldapMessage = ldapMessage;
     }
 
-    
+
     /**
      * Set a InternalMessage Object into the container. It will be completed by the
      * ldapDecoder.
@@ -366,12 +407,19 @@ public class LdapMessageContainer extend
         super.clean();
 
         ldapMessage = null;
+        internalMessage = null;
         messageId = 0;
         currentControl = null;
         decodeBytes = 0;
     }
 
 
+    public boolean isInternal()
+    {
+        return internalMessage != null;
+    }
+
+
     /**
      * @return Returns true if the attribute is binary.
      * @param id checks if an attribute id is binary
@@ -381,6 +429,7 @@ public class LdapMessageContainer extend
         return binaryAttributeDetector.isBinary( id );
     }
 
+
     /**
      * @return The message ID
      */
@@ -389,6 +438,7 @@ public class LdapMessageContainer extend
         return messageId;
     }
 
+
     /**
      * Set the message ID
      * @param messageId the id of the message
@@ -398,6 +448,7 @@ public class LdapMessageContainer extend
         this.messageId = messageId;
     }
 
+
     /**
      * @return the current control being created
      */
@@ -406,6 +457,7 @@ public class LdapMessageContainer extend
         return currentControl;
     }
 
+
     /**
      * Store a newly created control
      * @param currentControl The control to store

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java?rev=983534&r1=983533&r2=983534&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java Mon Aug  9 06:41:54 2010
@@ -38,7 +38,6 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.util.LongDecoder;
 import org.apache.directory.shared.asn1.util.LongDecoderException;
 import org.apache.directory.shared.i18n.I18n;
-import org.apache.directory.shared.ldap.codec.abandon.AbandonRequestCodec;
 import org.apache.directory.shared.ldap.codec.actions.AttributeDescAction;
 import org.apache.directory.shared.ldap.codec.actions.ControlValueAction;
 import org.apache.directory.shared.ldap.codec.actions.ControlsInitAction;
@@ -76,10 +75,9 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.bind.BindResponseCodec;
 import org.apache.directory.shared.ldap.codec.bind.SaslCredentials;
 import org.apache.directory.shared.ldap.codec.bind.SimpleAuthentication;
-import org.apache.directory.shared.ldap.codec.compare.CompareRequestCodec;
 import org.apache.directory.shared.ldap.codec.compare.CompareResponseCodec;
+import org.apache.directory.shared.ldap.codec.controls.ControlEnum;
 import org.apache.directory.shared.ldap.codec.controls.ControlImpl;
-import org.apache.directory.shared.ldap.codec.del.DelRequestCodec;
 import org.apache.directory.shared.ldap.codec.del.DelResponseCodec;
 import org.apache.directory.shared.ldap.codec.extended.ExtendedRequestCodec;
 import org.apache.directory.shared.ldap.codec.extended.ExtendedResponseCodec;
@@ -94,21 +92,29 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.search.SearchResultEntryCodec;
 import org.apache.directory.shared.ldap.codec.search.SearchResultReferenceCodec;
 import org.apache.directory.shared.ldap.codec.search.SubstringFilter;
-import org.apache.directory.shared.ldap.codec.unbind.UnBindRequestCodec;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.filter.SearchScope;
+import org.apache.directory.shared.ldap.message.AbandonRequestImpl;
 import org.apache.directory.shared.ldap.message.AddRequestImpl;
 import org.apache.directory.shared.ldap.message.AddResponseImpl;
 import org.apache.directory.shared.ldap.message.BindResponseImpl;
+import org.apache.directory.shared.ldap.message.CompareRequestImpl;
 import org.apache.directory.shared.ldap.message.CompareResponseImpl;
+import org.apache.directory.shared.ldap.message.DeleteRequestImpl;
 import org.apache.directory.shared.ldap.message.DeleteResponseImpl;
 import org.apache.directory.shared.ldap.message.ModifyDnResponseImpl;
 import org.apache.directory.shared.ldap.message.ModifyResponseImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.message.SearchResponseDoneImpl;
+import org.apache.directory.shared.ldap.message.UnbindRequestImpl;
 import org.apache.directory.shared.ldap.message.control.Control;
+import org.apache.directory.shared.ldap.message.internal.InternalAbandonRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalAddRequest;
+import org.apache.directory.shared.ldap.message.internal.InternalCompareRequest;
+import org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest;
+import org.apache.directory.shared.ldap.message.internal.InternalMessage;
+import org.apache.directory.shared.ldap.message.internal.InternalUnbindRequest;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.name.RDN;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -282,13 +288,11 @@ public class LdapMessageGrammar extends 
             {
                 public void action( IAsn1Container container ) throws DecoderException
                 {
-
                     LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
 
-                    // Create the  UnbindRequest LdapMessage instance and store it in the container
-                    UnBindRequestCodec unbindRequest = new UnBindRequestCodec();
-                    unbindRequest.setMessageId( ldapMessageContainer.getMessageId() );
-                    ldapMessageContainer.setLdapMessage( unbindRequest );
+                    // Create the UnbindRequest LdapMessage instance and store it in the container
+                    InternalUnbindRequest unbindRequest = new UnbindRequestImpl( ldapMessageContainer.getMessageId() );
+                    ldapMessageContainer.setInternalMessage( unbindRequest );
 
                     TLV tlv = ldapMessageContainer.getCurrentTLV();
                     int expectedLength = tlv.getLength();
@@ -334,9 +338,8 @@ public class LdapMessageGrammar extends 
                     LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
 
                     // Create the DeleteRequest LdapMessage instance and store it in the container
-                    DelRequestCodec delRequest = new DelRequestCodec();
-                    delRequest.setMessageId( ldapMessageContainer.getMessageId() );
-                    ldapMessageContainer.setLdapMessage( delRequest );
+                    InternalDeleteRequest delRequest = new DeleteRequestImpl( ldapMessageContainer.getMessageId() );
+                    ldapMessageContainer.setInternalMessage( delRequest );
 
                     // And store the DN into it
                     // Get the Value and store it in the DelRequest
@@ -371,7 +374,7 @@ public class LdapMessageGrammar extends 
                                 DN.EMPTY_DN, ine );
                         }
 
-                        delRequest.setEntry( entry );
+                        delRequest.setName( entry );
                     }
 
                     // We can have an END transition
@@ -411,9 +414,8 @@ public class LdapMessageGrammar extends 
                     LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
 
                     // Create the AbandonRequest LdapMessage instance and store it in the container
-                    AbandonRequestCodec abandonRequest = new AbandonRequestCodec();
-                    abandonRequest.setMessageId( ldapMessageContainer.getMessageId() );
-                    ldapMessageContainer.setLdapMessage( abandonRequest );
+                    InternalAbandonRequest abandonRequest = new AbandonRequestImpl( ldapMessageContainer.getMessageId() );
+                    ldapMessageContainer.setInternalMessage( abandonRequest );
 
                     // The current TLV should be a integer
                     // We get it and store it in MessageId
@@ -434,7 +436,7 @@ public class LdapMessageGrammar extends 
                     {
                         int abandonnedMessageId = IntegerDecoder.parse( value, 0, Integer.MAX_VALUE );
 
-                        abandonRequest.setAbandonedMessageId( abandonnedMessageId );
+                        abandonRequest.setAbandoned( abandonnedMessageId );
 
                         if ( IS_DEBUG )
                         {
@@ -2057,7 +2059,6 @@ public class LdapMessageGrammar extends 
             {
                 public void action( IAsn1Container container ) throws DecoderException
                 {
-
                     LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
 
                     // Now, we can allocate the AddResponse Object
@@ -2500,9 +2501,8 @@ public class LdapMessageGrammar extends 
                     LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
 
                     // Now, we can allocate the CompareRequest Object
-                    CompareRequestCodec compareRequest = new CompareRequestCodec();
-                    compareRequest.setMessageId( ldapMessageContainer.getMessageId() );
-                    ldapMessageContainer.setLdapMessage( compareRequest );
+                    InternalCompareRequest compareRequest = new CompareRequestImpl( ldapMessageContainer.getMessageId() );
+                    ldapMessageContainer.setInternalMessage( compareRequest );
 
                     log.debug( "Compare Request" );
                 }
@@ -2524,7 +2524,7 @@ public class LdapMessageGrammar extends 
                 {
 
                     LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
-                    CompareRequestCodec compareRequest = ldapMessageContainer.getCompareRequest();
+                    InternalCompareRequest compareRequest = ldapMessageContainer.getInternalCompareRequest();
 
                     // Get the Value and store it in the CompareRequest
                     TLV tlv = ldapMessageContainer.getCurrentTLV();
@@ -2557,7 +2557,7 @@ public class LdapMessageGrammar extends 
                                 DN.EMPTY_DN, ine );
                         }
 
-                        compareRequest.setEntry( entry );
+                        compareRequest.setName( entry );
                     }
 
                     if ( IS_DEBUG )
@@ -2600,7 +2600,7 @@ public class LdapMessageGrammar extends 
                     LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
 
                     // Get the CompareRequest Object
-                    CompareRequestCodec compareRequest = ldapMessageContainer.getCompareRequest();
+                    InternalCompareRequest compareRequest = ldapMessageContainer.getInternalCompareRequest();
 
                     // Get the Value and store it in the CompareRequest
                     TLV tlv = ldapMessageContainer.getCurrentTLV();
@@ -2614,15 +2614,15 @@ public class LdapMessageGrammar extends 
                         CompareResponseImpl response = new CompareResponseImpl( compareRequest.getMessageId() );
 
                         throw new ResponseCarryingException( msg, response, ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX,
-                            compareRequest.getEntry(), null );
+                            compareRequest.getName(), null );
                     }
 
                     String type = StringTools.getType( tlv.getValue().getData() );
-                    compareRequest.setAttributeDesc( type );
+                    compareRequest.setAttributeId( type );
 
                     if ( IS_DEBUG )
                     {
-                        log.debug( "Comparing attribute description {}", compareRequest.getAttributeDesc() );
+                        log.debug( "Comparing attribute description {}", compareRequest.getAttributeId() );
                     }
                 }
             } );
@@ -2647,7 +2647,7 @@ public class LdapMessageGrammar extends 
                     LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
 
                     // Get the CompareRequest Object
-                    CompareRequestCodec compareRequest = ldapMessageContainer.getCompareRequest();
+                    InternalCompareRequest compareRequest = ldapMessageContainer.getInternalCompareRequest();
 
                     // Get the Value and store it in the CompareRequest
                     TLV tlv = ldapMessageContainer.getCurrentTLV();
@@ -2659,14 +2659,14 @@ public class LdapMessageGrammar extends 
                     }
                     else
                     {
-                        if ( ldapMessageContainer.isBinary( compareRequest.getAttributeDesc() ) )
+                        if ( ldapMessageContainer.isBinary( compareRequest.getAttributeId() ) )
                         {
                             compareRequest.setAssertionValue( tlv.getValue().getData() );
 
                             if ( IS_DEBUG )
                             {
-                                log.debug( "Comparing attribute value {}", StringTools
-                                    .dumpBytes( ( byte[] ) compareRequest.getAssertionValue() ) );
+                                log.debug( "Comparing attribute value {}", StringTools.dumpBytes( compareRequest
+                                    .getAssertionValue().getBytes() ) );
                             }
                         }
                         else
@@ -3417,13 +3417,9 @@ public class LdapMessageGrammar extends 
                 public void action( IAsn1Container container ) throws DecoderException
                 {
                     LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
-                    LdapMessageCodec message = ldapMessageContainer.getLdapMessage();
 
                     TLV tlv = ldapMessageContainer.getCurrentTLV();
 
-                    // Get the current control
-                    Control control = null;
-
                     // Store the type
                     // We have to handle the special case of a 0 length OID
                     if ( tlv.getLength() == 0 )
@@ -3447,24 +3443,43 @@ public class LdapMessageGrammar extends 
                         throw new DecoderException( I18n.err( I18n.ERR_04099, oidValue ) );
                     }
 
-                    // get the Control for this OID
-                    control = message.getCodecControl( oidValue );
-
-                    if ( control == null )
+                    if ( !ldapMessageContainer.isInternal() )
                     {
-                        // This control is unknown, we will create a neutral control
-                        control = new ControlImpl( oidValue );
+                        LdapMessageCodec message = ldapMessageContainer.getLdapMessage();
+
+                        // get the Control for this OID
+                        Control control = message.getCodecControl( oidValue );
+
+                        if ( control == null )
+                        {
+                            // This control is unknown, we will create a neutral control
+                            control = new ControlImpl( oidValue );
+                        }
+
+                        // The control may be null, if not known
+                        message.addControl( control );
                     }
+                    else
+                    {
+                        InternalMessage message = ldapMessageContainer.getInternalMessage();
 
-                    // The control may be null, if not known
-                    message.addControl( control );
+                        Control control = ControlEnum.getControl( oidValue );
+
+                        if ( control == null )
+                        {
+                            // This control is unknown, we will create a neutral control
+                            control = new ControlImpl( oidValue );
+                        }
+
+                        message.add( control );
+                    }
 
                     // We can have an END transition
                     ldapMessageContainer.grammarEndAllowed( true );
 
                     if ( IS_DEBUG )
                     {
-                        log.debug( "Control OID : " + control.getOid() );
+                        log.debug( "Control OID : " + oidValue );
                     }
                 }
             } );
@@ -3485,12 +3500,23 @@ public class LdapMessageGrammar extends 
                 public void action( IAsn1Container container ) throws DecoderException
                 {
                     LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
-                    LdapMessageCodec message = ldapMessageContainer.getLdapMessage();
 
                     TLV tlv = ldapMessageContainer.getCurrentTLV();
 
                     // Get the current control
-                    Control control = message.getCurrentControl();
+                    Control control = null;
+
+                    if ( !ldapMessageContainer.isInternal() )
+                    {
+                        LdapMessageCodec message = ldapMessageContainer.getLdapMessage();
+
+                        control = message.getCurrentControl();
+                    }
+                    else
+                    {
+                        InternalMessage message = ldapMessageContainer.getInternalMessage();
+                        control = message.getCurrentControl();
+                    }
 
                     // Store the criticality
                     // We get the value. If it's a 0, it's a FALSE. If it's

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapTransformer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapTransformer.java?rev=983534&r1=983533&r2=983534&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapTransformer.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapTransformer.java Mon Aug  9 06:41:54 2010
@@ -29,7 +29,6 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.primitives.OID;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.abandon.AbandonRequestCodec;
-import org.apache.directory.shared.ldap.codec.add.AddRequestCodec;
 import org.apache.directory.shared.ldap.codec.add.AddResponseCodec;
 import org.apache.directory.shared.ldap.codec.bind.BindRequestCodec;
 import org.apache.directory.shared.ldap.codec.bind.BindResponseCodec;
@@ -37,7 +36,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.bind.SimpleAuthentication;
 import org.apache.directory.shared.ldap.codec.compare.CompareRequestCodec;
 import org.apache.directory.shared.ldap.codec.compare.CompareResponseCodec;
-import org.apache.directory.shared.ldap.codec.del.DelRequestCodec;
 import org.apache.directory.shared.ldap.codec.del.DelResponseCodec;
 import org.apache.directory.shared.ldap.codec.extended.ExtendedRequestCodec;
 import org.apache.directory.shared.ldap.codec.extended.ExtendedResponseCodec;
@@ -79,14 +77,12 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.filter.SimpleNode;
 import org.apache.directory.shared.ldap.filter.SubstringNode;
 import org.apache.directory.shared.ldap.message.AbandonRequestImpl;
-import org.apache.directory.shared.ldap.message.AddRequestImpl;
 import org.apache.directory.shared.ldap.message.AddResponseImpl;
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
 import org.apache.directory.shared.ldap.message.BindRequestImpl;
 import org.apache.directory.shared.ldap.message.BindResponseImpl;
 import org.apache.directory.shared.ldap.message.CompareRequestImpl;
 import org.apache.directory.shared.ldap.message.CompareResponseImpl;
-import org.apache.directory.shared.ldap.message.DeleteRequestImpl;
 import org.apache.directory.shared.ldap.message.DeleteResponseImpl;
 import org.apache.directory.shared.ldap.message.ExtendedRequestImpl;
 import org.apache.directory.shared.ldap.message.ExtendedResponseImpl;
@@ -149,27 +145,6 @@ public class LdapTransformer
 
 
     /**
-     * Transform an AddRequest message from a addRequest to a InternalMessage
-     * 
-     * @param addRequest The message to transform
-     * @param messageId The message Id
-     * @return A Internal AddRequestImpl
-     */
-    private static InternalMessage transformAddRequest( AddRequestCodec addRequest, int messageId )
-    {
-        AddRequestImpl internalMessage = new AddRequestImpl( messageId );
-
-        // Codec : DN entry -> Internal : String name
-        internalMessage.setEntry( addRequest.getEntry() );
-
-        // Codec : Attributes attributes -> Internal : Attributes entry
-        internalMessage.setEntry( addRequest.getEntry() );
-
-        return internalMessage;
-    }
-
-
-    /**
      * Transform a BindRequest message from a CodecMessage to a InternalMessage
      * 
      * @param bindRequest The message to transform
@@ -301,24 +276,6 @@ public class LdapTransformer
 
 
     /**
-     * Transform a DelRequest message from a CodecMessage to a InternalMessage
-     * 
-     * @param delRequest The message to transform
-     * @param messageId The message Id
-     * @return A Internal DeleteRequestImpl
-     */
-    private static InternalMessage transformDelRequest( DelRequestCodec delRequest, int messageId )
-    {
-        DeleteRequestImpl internalMessage = new DeleteRequestImpl( messageId );
-
-        // Codec : DN entry -> Internal : DN
-        internalMessage.setName( delRequest.getEntry() );
-
-        return internalMessage;
-    }
-
-
-    /**
      * Transform an ExtendedRequest message from a CodecMessage to a
      * InternalMessage
      * 
@@ -787,11 +744,6 @@ public class LdapTransformer
      */
     public static InternalMessage transform( Object obj )
     {
-        if ( obj instanceof InternalMessage )
-        {
-            return ( InternalMessage ) obj;
-        }
-
         LdapMessageCodec codecMessage = ( LdapMessageCodec ) obj;
         int messageId = codecMessage.getMessageId();
 
@@ -811,10 +763,6 @@ public class LdapTransformer
                 internalMessage = transformBindRequest( ( BindRequestCodec ) codecMessage, messageId );
                 break;
 
-            case UNBIND_REQUEST:
-                internalMessage = transformUnBindRequest( messageId );
-                break;
-
             case SEARCH_REQUEST:
                 internalMessage = transformSearchRequest( ( SearchRequestCodec ) codecMessage, messageId );
                 break;
@@ -823,26 +771,10 @@ public class LdapTransformer
                 internalMessage = transformModifyRequest( ( ModifyRequestCodec ) codecMessage, messageId );
                 break;
 
-            case ADD_REQUEST:
-                internalMessage = transformAddRequest( ( AddRequestCodec ) codecMessage, messageId );
-                break;
-
-            case DEL_REQUEST:
-                internalMessage = transformDelRequest( ( DelRequestCodec ) codecMessage, messageId );
-                break;
-
             case MODIFYDN_REQUEST:
                 internalMessage = transformModifyDNRequest( ( ModifyDNRequestCodec ) codecMessage, messageId );
                 break;
 
-            case COMPARE_REQUEST:
-                internalMessage = transformCompareRequest( ( CompareRequestCodec ) codecMessage, messageId );
-                break;
-
-            case ABANDON_REQUEST:
-                internalMessage = transformAbandonRequest( ( AbandonRequestCodec ) codecMessage, messageId );
-                break;
-
             case EXTENDED_REQUEST:
                 internalMessage = transformExtendedRequest( ( ExtendedRequestCodec ) codecMessage, messageId );
                 break;

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlValueAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlValueAction.java?rev=983534&r1=983533&r2=983534&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlValueAction.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlValueAction.java Mon Aug  9 06:41:54 2010
@@ -30,6 +30,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.controls.CodecControl;
 import org.apache.directory.shared.ldap.codec.controls.ControlDecoder;
 import org.apache.directory.shared.ldap.message.control.Control;
+import org.apache.directory.shared.ldap.message.internal.InternalMessage;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -55,13 +56,23 @@ public class ControlValueAction extends 
     {
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
         TLV tlv = ldapMessageContainer.getCurrentTLV();
-        LdapMessageCodec message = ldapMessageContainer.getLdapMessage();
+        Control control = null;
+
+        if ( !ldapMessageContainer.isInternal() )
+        {
+            LdapMessageCodec message = ldapMessageContainer.getLdapMessage();
+            control = message.getCurrentControl();
+        }
+        else
+        {
+            InternalMessage message = ldapMessageContainer.getInternalMessage();
+            control = message.getCurrentControl();
+        }
 
         // Get the current control
-        Control control = message.getCurrentControl();
         Value value = tlv.getValue();
 
-        ControlDecoder decoder = ((CodecControl)control).getDecoder();
+        ControlDecoder decoder = ( ( CodecControl ) control ).getDecoder();
 
         // Store the value - have to handle the special case of a 0 length value
         if ( tlv.getLength() == 0 )

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlsInitAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlsInitAction.java?rev=983534&r1=983533&r2=983534&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlsInitAction.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlsInitAction.java Mon Aug  9 06:41:54 2010
@@ -26,7 +26,6 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.ldap.codec.LdapMessageCodec;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -44,11 +43,13 @@ public class ControlsInitAction extends 
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public ControlsInitAction()
     {
         super( "Initialize a control" );
     }
 
+
     /**
      * The initialization action
      */
@@ -56,7 +57,6 @@ public class ControlsInitAction extends 
     {
 
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
-        LdapMessageCodec message = ldapMessageContainer.getLdapMessage();
 
         TLV tlv = ldapMessageContainer.getCurrentTLV();
         int expectedLength = tlv.getLength();
@@ -65,17 +65,22 @@ public class ControlsInitAction extends 
         if ( expectedLength == 0 )
         {
             log.error( "The length of controls must not be null" );
-            
+
             // This will generate a PROTOCOL_ERROR
             throw new DecoderException( "The length of controls must not be null" );
         }
-        
+
         if ( IS_DEBUG )
         {
             log.debug( "A new list of controls has been initialized" );
         }
-        
-        // We can initialize the controls array
-        message.initControls();
+
+        if ( !ldapMessageContainer.isInternal() )
+        {
+            LdapMessageCodec message = ldapMessageContainer.getLdapMessage();
+
+            // We can initialize the controls array
+            message.initControls();
+        }
     }
 }

Added: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlEnum.java?rev=983534&view=auto
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlEnum.java (added)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlEnum.java Mon Aug  9 06:41:54 2010
@@ -0,0 +1,150 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  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. 
+ *  
+ */
+package org.apache.directory.shared.ldap.codec.controls;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.directory.shared.ldap.codec.controls.replication.syncDoneValue.SyncDoneValueControl;
+import org.apache.directory.shared.ldap.codec.controls.replication.syncInfoValue.SyncInfoValueControl;
+import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueControl;
+import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.SyncStateValueControl;
+import org.apache.directory.shared.ldap.codec.search.controls.pagedSearch.PagedResultsControl;
+import org.apache.directory.shared.ldap.codec.search.controls.persistentSearch.PersistentSearchControl;
+import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesControl;
+import org.apache.directory.shared.ldap.message.control.Control;
+import org.apache.directory.shared.ldap.message.control.replication.SynchronizationInfoEnum;
+
+
+/**
+ * An enumeration of all the existng controls. It currently includes :
+ * <ul>
+ *   <li></li>
+ *   <li></li>
+ *   <li></li>
+ *   <li></li>
+ *   <li></li>
+ *   <li></li>
+ *   <li></li>
+ *   <li></li>
+ *   <li></li>
+ *   <li></li>
+ * </ul>
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public enum ControlEnum
+{
+    /** The ManageDsaIt control */
+    MANAGE_DSA_IT(new ManageDsaITControl()),
+
+    /** The PagedResults control */
+    PAGED_RESULTS(new PagedResultsControl()),
+
+    /** The PersistentSearch control */
+    PERSISTENT_SEARCH(new PersistentSearchControl()),
+
+    /** The Subentries control */
+    SUBENTRIES(new SubentriesControl()),
+
+    /** The SyncDoneValue control */
+    SYNC_DONE_VALUE(new SyncDoneValueControl()),
+
+    /** The SyncInfoValue (new cookie) control */
+    SYNC_INFO_VALUE_NEW_COOKIE(new SyncInfoValueControl( SynchronizationInfoEnum.NEW_COOKIE )),
+
+    /** The SyncInfoValue (refresh delete) control */
+    SYNC_INFO_VALUE_REFRESH_DELETE(new SyncInfoValueControl( SynchronizationInfoEnum.REFRESH_DELETE )),
+
+    /** The SyncInfoValue (refresh present) control */
+    SYNC_INFO_VALUE_REFRESH_PRESENT(new SyncInfoValueControl( SynchronizationInfoEnum.REFRESH_PRESENT )),
+
+    /** The SyncInfoValue (sync id set) control */
+    SYNC_INFO_VALUE_SYNC_ID_SET(new SyncInfoValueControl( SynchronizationInfoEnum.SYNC_ID_SET )),
+
+    /** The SyncRequestValueControl control */
+    SYNC_REQUEST_VALUE(new SyncRequestValueControl()),
+
+    /** The SyncStateValueControl control */
+    SYNC_STATE_VALUE(new SyncStateValueControl());
+
+    /** The internal control instance */
+    private Control control;
+
+    /** The control's oid */
+    private String oid;
+
+    private static Map<String, Control> codecControls = new HashMap<String, Control>();
+
+    static
+    {
+        // Initialize the different known Controls
+        codecControls.put( MANAGE_DSA_IT.getOid(), MANAGE_DSA_IT.getControl() );
+        codecControls.put( PAGED_RESULTS.getOid(), PAGED_RESULTS.getControl() );
+        codecControls.put( PERSISTENT_SEARCH.getOid(), PERSISTENT_SEARCH.getControl() );
+        codecControls.put( SUBENTRIES.getOid(), SUBENTRIES.getControl() );
+        codecControls.put( SYNC_DONE_VALUE.getOid(), SYNC_DONE_VALUE.getControl() );
+        codecControls.put( SYNC_INFO_VALUE_NEW_COOKIE.getOid(), SYNC_INFO_VALUE_NEW_COOKIE.getControl() );
+        codecControls.put( SYNC_INFO_VALUE_REFRESH_DELETE.getOid(), SYNC_INFO_VALUE_REFRESH_DELETE.getControl() );
+        codecControls.put( SYNC_INFO_VALUE_REFRESH_PRESENT.getOid(), SYNC_INFO_VALUE_REFRESH_PRESENT.getControl() );
+        codecControls.put( SYNC_INFO_VALUE_SYNC_ID_SET.getOid(), SYNC_INFO_VALUE_SYNC_ID_SET.getControl() );
+        codecControls.put( SYNC_REQUEST_VALUE.getOid(), SYNC_REQUEST_VALUE.getControl() );
+        codecControls.put( SYNC_STATE_VALUE.getOid(), SYNC_STATE_VALUE.getControl() );
+    }
+
+
+    /**
+     * Create a new instance of the control identified by its oid
+     * @param oid The Control's oid
+     */
+    private ControlEnum( Control control )
+    {
+        this.control = control;
+        this.oid = control.getOid();
+    }
+
+
+    /**
+     * @return The associated control instance
+     */
+    public Control getControl()
+    {
+        return control;
+    }
+
+
+    /**
+     * @return The associated control instance
+     */
+    public static Control getControl( String oid )
+    {
+        return codecControls.get( oid );
+    }
+
+
+    /**
+     * @return The control's OID
+     */
+    public String getOid()
+    {
+        return oid;
+    }
+}

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalAbstractMessage.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalAbstractMessage.java?rev=983534&r1=983533&r2=983534&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalAbstractMessage.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalAbstractMessage.java Mon Aug  9 06:41:54 2010
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.shared.ldap.message.internal;
 
+
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -30,7 +31,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.control.Control;
 
 
-
 /**
  * Abstract message base class.
  * 
@@ -52,6 +52,9 @@ public abstract class InternalAbstractMe
     /** Transient Message Parameter Hash */
     private final Map<Object, Object> parameters;
 
+    /** The current control */
+    private Control currentControl;
+
 
     /**
      * Completes the instantiation of a Message.
@@ -95,7 +98,18 @@ public abstract class InternalAbstractMe
         return Collections.unmodifiableMap( controls );
     }
 
-    
+
+    /**
+     * Get the current Control Object
+     * 
+     * @return The current Control Object
+     */
+    public Control getCurrentControl()
+    {
+        return currentControl;
+    }
+
+
     /**
      * @see org.apache.directory.shared.ldap.message.internal.InternalMessage#hasControl(java.lang.String)
      */
@@ -103,7 +117,7 @@ public abstract class InternalAbstractMe
     {
         return controls.containsKey( oid );
     }
-    
+
 
     /**
      * Adds a control to this Message.
@@ -117,6 +131,7 @@ public abstract class InternalAbstractMe
     public void add( Control control ) throws MessageException
     {
         controls.put( control.getOid(), control );
+        currentControl = control;
     }
 
 
@@ -219,14 +234,14 @@ public abstract class InternalAbstractMe
         }
 
         Map<String, Control> controls = msg.getControls();
-        
+
         if ( controls.size() != this.controls.size() )
         {
             return false;
         }
 
         Iterator<String> list = this.controls.keySet().iterator();
-        
+
         while ( list.hasNext() )
         {
             if ( !controls.containsKey( list.next() ) )
@@ -237,7 +252,8 @@ public abstract class InternalAbstractMe
 
         return true;
     }
-    
+
+
     /**
      * @see Object#hashCode()
      * @return the instance's hash code 
@@ -245,11 +261,11 @@ public abstract class InternalAbstractMe
     public int hashCode()
     {
         int hash = 37;
-        hash = hash*17 + id;
-        hash = hash*17 + ( type == null ? 0 : type.hashCode() );
-        hash = hash*17 + ( parameters == null ? 0 : parameters.hashCode() );
-        hash = hash*17 + ( controls == null ? 0 : controls.hashCode() );
-        
+        hash = hash * 17 + id;
+        hash = hash * 17 + ( type == null ? 0 : type.hashCode() );
+        hash = hash * 17 + ( parameters == null ? 0 : parameters.hashCode() );
+        hash = hash * 17 + ( controls == null ? 0 : controls.hashCode() );
+
         return hash;
     }
 

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalMessage.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalMessage.java?rev=983534&r1=983533&r2=983534&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalMessage.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalMessage.java Mon Aug  9 06:41:54 2010
@@ -53,7 +53,15 @@ public interface InternalMessage
      */
     Map<String, Control> getControls();
 
-    
+
+    /**
+     * Get the current Control Object
+     * 
+     * @return The current Control Object
+     */
+    Control getCurrentControl();
+
+
     /**
      * Checks whether or not this message has the specified control.
      *
@@ -61,7 +69,7 @@ public interface InternalMessage
      * @return true if this message has the control, false if it does not
      */
     boolean hasControl( String oid );
-    
+
 
     /**
      * Adds a control to this Message.



Mime
View raw message