directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r1064981 [7/8] - in /directory: apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/ apacheds/trunk/protocol-ldap/src/main/java/org/apach...
Date Sat, 29 Jan 2011 08:23:06 GMT
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeGrammar.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeGrammar.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeGrammar.java Sat Jan 29 08:23:02 2011
@@ -20,7 +20,6 @@
 package org.apache.directory.shared.ldap.codec.search.controls.entryChange;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.asn1.ber.grammar.AbstractGrammar;
 import org.apache.directory.shared.asn1.ber.grammar.Grammar;
 import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
@@ -89,12 +88,11 @@ public final class EntryChangeGrammar ex
             new GrammarTransition( EntryChangeStates.EC_SEQUENCE_STATE,
                                     EntryChangeStates.CHANGE_TYPE_STATE,
                                     UniversalTag.ENUMERATED.getValue(),
-            new GrammarAction( "Set EntryChangeControl changeType" )
+            new GrammarAction<EntryChangeContainer>( "Set EntryChangeControl changeType" )
         {
-            public void action( Asn1Container container ) throws DecoderException
+            public void action( EntryChangeContainer container ) throws DecoderException
             {
-                EntryChangeContainer entryChangeContainer = ( EntryChangeContainer ) container;
-                Value value = entryChangeContainer.getCurrentTLV().getValue();
+                Value value = container.getCurrentTLV().getValue();
 
                 try
                 {
@@ -113,7 +111,7 @@ public final class EntryChangeGrammar ex
                                 LOG.debug( "changeType = " + changeType );
                             }
 
-                            entryChangeContainer.getEntryChangeDecorator().setChangeType( changeType );
+                            container.getEntryChangeDecorator().setChangeType( changeType );
                             break;
 
                         default:
@@ -123,7 +121,7 @@ public final class EntryChangeGrammar ex
                     }
 
                     // We can have an END transition
-                    entryChangeContainer.setGrammarEndAllowed( true );
+                    container.setGrammarEndAllowed( true );
                 }
                 catch ( IntegerDecoderException e )
                 {
@@ -152,13 +150,11 @@ public final class EntryChangeGrammar ex
             new GrammarTransition( EntryChangeStates.CHANGE_TYPE_STATE,
                                     EntryChangeStates.PREVIOUS_DN_STATE,
                                     UniversalTag.OCTET_STRING.getValue(),
-            new GrammarAction( "Set EntryChangeControl previousDN" )
+            new GrammarAction<EntryChangeContainer>( "Set EntryChangeControl previousDN" )
         {
-            public void action( Asn1Container container ) throws DecoderException
+            public void action( EntryChangeContainer container ) throws DecoderException
             {
-                EntryChangeContainer entryChangeContainer = ( EntryChangeContainer ) container;
-
-                ChangeType changeType = entryChangeContainer.getEntryChangeDecorator().getChangeType();
+                ChangeType changeType = container.getEntryChangeDecorator().getChangeType();
 
 
                 if ( changeType != ChangeType.MODDN )
@@ -168,7 +164,7 @@ public final class EntryChangeGrammar ex
                 }
                 else
                 {
-                    Value value = entryChangeContainer.getCurrentTLV().getValue();
+                    Value value = container.getCurrentTLV().getValue();
                     Dn previousDn;
 
                     try
@@ -186,21 +182,20 @@ public final class EntryChangeGrammar ex
                         LOG.debug( "previousDN = " + previousDn );
                     }
 
-                    entryChangeContainer.getEntryChangeDecorator().setPreviousDn( previousDn );
+                    container.getEntryChangeDecorator().setPreviousDn( previousDn );
 
                     // We can have an END transition
-                    entryChangeContainer.setGrammarEndAllowed( true );
+                    container.setGrammarEndAllowed( true );
                 }
             }
         } );
 
         // Change Number action
-        GrammarAction setChangeNumberAction = new GrammarAction( "Set EntryChangeControl changeNumber" )
+        GrammarAction<EntryChangeContainer> setChangeNumberAction = new GrammarAction<EntryChangeContainer>( "Set EntryChangeControl changeNumber" )
         {
-            public void action( Asn1Container container ) throws DecoderException
+            public void action( EntryChangeContainer container ) throws DecoderException
             {
-                EntryChangeContainer entryChangeContainer = ( EntryChangeContainer ) container;
-                Value value = entryChangeContainer.getCurrentTLV().getValue();
+                Value value = container.getCurrentTLV().getValue();
 
                 try
                 {
@@ -211,10 +206,10 @@ public final class EntryChangeGrammar ex
                         LOG.debug( "changeNumber = " + changeNumber );
                     }
 
-                    entryChangeContainer.getEntryChangeDecorator().setChangeNumber( changeNumber );
+                    container.getEntryChangeDecorator().setChangeNumber( changeNumber );
 
                     // We can have an END transition
-                    entryChangeContainer.setGrammarEndAllowed( true );
+                    container.setGrammarEndAllowed( true );
                 }
                 catch ( LongDecoderException e )
                 {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsDecorator.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsDecorator.java Sat Jan 29 08:23:02 2011
@@ -23,7 +23,10 @@ package org.apache.directory.shared.ldap
 import java.nio.ByteBuffer;
 import java.util.Arrays;
 
+import org.apache.directory.shared.asn1.Asn1Object;
+import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.asn1.EncoderException;
+import org.apache.directory.shared.asn1.ber.Asn1Decoder;
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
@@ -39,11 +42,17 @@ import org.apache.directory.shared.util.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class PagedResultsDecorator extends ControlDecorator implements PagedResults
+public class PagedResultsDecorator extends ControlDecorator<PagedResults> implements PagedResults
 {
     /** The entry change global length */
     private int pscSeqLength;
 
+    /** The encoded value of the control. */
+    private byte[] value;
+    
+    /** An instance of this decoder */
+    private static final Asn1Decoder decoder = new Asn1Decoder();
+
 
     /**
      * Creates a new instance of PagedResultsDecorator with a newly created decorated
@@ -63,7 +72,7 @@ public class PagedResultsDecorator exten
      */
     public PagedResultsDecorator( PagedResults pagedResults )
     {
-        super( pagedResults, new PagedResultsDecoder() );
+        super( pagedResults );
     }
 
 
@@ -140,7 +149,7 @@ public class PagedResultsDecorator exten
      */
     public byte[] getValue()
     {
-        if ( getDecorated().getValue() == null )
+        if ( value == null )
         {
             try
             {
@@ -154,7 +163,7 @@ public class PagedResultsDecorator exten
                 Value.encode( buffer, getSize() );
                 Value.encode( buffer, getCookie() );
 
-                getDecorated().setValue( buffer.array() );
+                value = buffer.array();
             }
             catch ( Exception e )
             {
@@ -162,7 +171,7 @@ public class PagedResultsDecorator exten
             }
         }
 
-        return getDecorated().getValue();
+        return value;
     }
 
 
@@ -249,7 +258,6 @@ public class PagedResultsDecorator exten
     /**
      * @see Object#equals(Object)
      */
-    @SuppressWarnings( { "EqualsWhichDoesntCheckParameterClass" } )
     @Override
     public boolean equals( Object o )
     {
@@ -279,4 +287,14 @@ public class PagedResultsDecorator exten
 
         return sb.toString();
     }
+
+
+    @Override
+    public Asn1Object decode( byte[] controlBytes ) throws DecoderException
+    {
+        ByteBuffer bb = ByteBuffer.wrap( controlBytes );
+        PagedResultsContainer container = new PagedResultsContainer( this );
+        decoder.decode( bb, container );
+        return this;
+    }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsGrammar.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsGrammar.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsGrammar.java Sat Jan 29 08:23:02 2011
@@ -21,7 +21,6 @@ package org.apache.directory.shared.ldap
 
 
 import org.apache.directory.shared.asn1.DecoderException;
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.asn1.ber.grammar.AbstractGrammar;
 import org.apache.directory.shared.asn1.ber.grammar.Grammar;
 import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
@@ -97,12 +96,11 @@ public final class PagedResultsGrammar e
             new GrammarTransition( PagedResultsStates.PAGED_SEARCH_SEQUENCE_STATE,
                 PagedResultsStates.SIZE_STATE,
                 UniversalTag.INTEGER.getValue(),
-                new GrammarAction( "Set PagedSearchControl size" )
+                new GrammarAction<PagedResultsContainer>( "Set PagedSearchControl size" )
             {
-                public void action( Asn1Container container ) throws DecoderException
+                public void action( PagedResultsContainer container ) throws DecoderException
                 {
-                    PagedResultsContainer pagedSearchContainer = ( PagedResultsContainer ) container;
-                    Value value = pagedSearchContainer.getCurrentTLV().getValue();
+                    Value value = container.getCurrentTLV().getValue();
 
                     try
                     {
@@ -121,7 +119,7 @@ public final class PagedResultsGrammar e
                             LOG.debug( "size = " + size );
                         }
 
-                        pagedSearchContainer.getDecorator().setSize( size );
+                        container.getDecorator().setSize( size );
                     }
                     catch ( IntegerDecoderException e )
                     {
@@ -144,24 +142,23 @@ public final class PagedResultsGrammar e
         super.transitions[ PagedResultsStates.SIZE_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] =
             new GrammarTransition( PagedResultsStates.SIZE_STATE,
                                     PagedResultsStates.COOKIE_STATE, UniversalTag.OCTET_STRING.getValue(),
-                new GrammarAction( "Set PagedSearchControl cookie" )
+                new GrammarAction<PagedResultsContainer>( "Set PagedSearchControl cookie" )
             {
-                public void action( Asn1Container container ) throws DecoderException
+                public void action( PagedResultsContainer container ) throws DecoderException
                 {
-                    PagedResultsContainer pagedSearchContainer = ( PagedResultsContainer ) container;
-                    Value value = pagedSearchContainer.getCurrentTLV().getValue();
+                    Value value = container.getCurrentTLV().getValue();
 
-                    if ( pagedSearchContainer.getCurrentTLV().getLength() == 0 )
+                    if ( container.getCurrentTLV().getLength() == 0 )
                     {
-                        pagedSearchContainer.getDecorator().setCookie( StringConstants.EMPTY_BYTES );
+                        container.getDecorator().setCookie( StringConstants.EMPTY_BYTES );
                     }
                     else
                     {
-                        pagedSearchContainer.getDecorator().setCookie( value.getData() );
+                        container.getDecorator().setCookie( value.getData() );
                     }
 
                     // We can have an END transition
-                    pagedSearchContainer.setGrammarEndAllowed( true );
+                    container.setGrammarEndAllowed( true );
                 }
             } );
     }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchDecorator.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchDecorator.java Sat Jan 29 08:23:02 2011
@@ -22,7 +22,10 @@ package org.apache.directory.shared.ldap
 
 import java.nio.ByteBuffer;
 
+import org.apache.directory.shared.asn1.Asn1Object;
+import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.asn1.EncoderException;
+import org.apache.directory.shared.asn1.ber.Asn1Decoder;
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
@@ -38,12 +41,18 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class PersistentSearchDecorator extends ControlDecorator implements PersistentSearch
+public class PersistentSearchDecorator extends ControlDecorator<PersistentSearch> implements PersistentSearch
 {
     /** A temporary storage for a psearch length */
     private int psearchSeqLength;
 
+    /** The encoded value of the control. */
+    private byte[] value;
+    
+    /** An instance of this decoder */
+    private static final Asn1Decoder decoder = new Asn1Decoder();
 
+    
     /**
      * Default constructor creates a PersistentSearch Control automatically
      * wrapped in a decorator object inside this container.
@@ -62,7 +71,7 @@ public class PersistentSearchDecorator e
      */
     public PersistentSearchDecorator( PersistentSearch control )
     {
-        super( control, new PersistentSearchDecoder() );
+        super( control );
     }
 
 
@@ -132,7 +141,7 @@ public class PersistentSearchDecorator e
      */
     public byte[] getValue()
     {
-        if ( getDecorated().getValue() == null )
+        if ( value == null )
         {
             try
             { 
@@ -147,7 +156,7 @@ public class PersistentSearchDecorator e
                 Value.encode( buffer, isChangesOnly() );
                 Value.encode( buffer, isReturnECs() );
 
-                getDecorated().setValue( buffer.array() );
+                value = buffer.array();
             }
             catch ( Exception e )
             {
@@ -155,7 +164,7 @@ public class PersistentSearchDecorator e
             }
         }
         
-        return getDecorated().getValue();
+        return value;
     }
 
 
@@ -212,4 +221,14 @@ public class PersistentSearchDecorator e
     {
         getPersistentSearch().enableNotification( changeType );
     }
+
+
+    @Override
+    public Asn1Object decode( byte[] controlBytes ) throws DecoderException
+    {
+        ByteBuffer bb = ByteBuffer.wrap( controlBytes );
+        PersistentSearchContainer container = new PersistentSearchContainer( this );
+        decoder.decode( bb, container );
+        return this;
+    }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchGrammar.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchGrammar.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchGrammar.java Sat Jan 29 08:23:02 2011
@@ -20,8 +20,7 @@
 package org.apache.directory.shared.ldap.codec.search.controls.persistentSearch;
 
 
-import org.apache.directory.shared.asn1.DecoderException;
-import org.apache.directory.shared.asn1.ber.Asn1Container;
+import org.apache.directory.shared.asn1.DecoderException; 
 import org.apache.directory.shared.asn1.ber.grammar.AbstractGrammar;
 import org.apache.directory.shared.asn1.ber.grammar.Grammar;
 import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
@@ -101,12 +100,11 @@ public final class PersistentSearchGramm
             new GrammarTransition( PersistentSearchStates.PSEARCH_SEQUENCE_STATE,
                 PersistentSearchStates.CHANGE_TYPES_STATE,
                 UniversalTag.INTEGER.getValue(),
-                new GrammarAction( "Set PSearchControl changeTypes" )
+                new GrammarAction<PersistentSearchContainer>( "Set PSearchControl changeTypes" )
             {
-                public void action( Asn1Container container ) throws DecoderException
+                public void action( PersistentSearchContainer container ) throws DecoderException
                 {
-                    PersistentSearchContainer psearchContainer = ( PersistentSearchContainer ) container;
-                    Value value = psearchContainer.getCurrentTLV().getValue();
+                    Value value = container.getCurrentTLV().getValue();
 
                     try
                     {
@@ -120,7 +118,7 @@ public final class PersistentSearchGramm
                             LOG.debug( "changeTypes = " + changeTypes );
                         }
 
-                        psearchContainer.getPersistentSearchDecorator().setChangeTypes( changeTypes );
+                        container.getPersistentSearchDecorator().setChangeTypes( changeTypes );
                     }
                     catch ( IntegerDecoderException e )
                     {
@@ -143,12 +141,11 @@ public final class PersistentSearchGramm
         super.transitions[ PersistentSearchStates.CHANGE_TYPES_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] =
             new GrammarTransition( PersistentSearchStates.CHANGE_TYPES_STATE,
                                     PersistentSearchStates.CHANGES_ONLY_STATE, UniversalTag.BOOLEAN.getValue(),
-                new GrammarAction( "Set PSearchControl changesOnly" )
+                new GrammarAction<PersistentSearchContainer>( "Set PSearchControl changesOnly" )
             {
-                public void action( Asn1Container container ) throws DecoderException
+                public void action( PersistentSearchContainer container ) throws DecoderException
                 {
-                    PersistentSearchContainer psearchContainer = ( PersistentSearchContainer ) container;
-                    Value value = psearchContainer.getCurrentTLV().getValue();
+                    Value value = container.getCurrentTLV().getValue();
 
                     try
                     {
@@ -159,7 +156,7 @@ public final class PersistentSearchGramm
                             LOG.debug( "changesOnly = " + changesOnly );
                         }
 
-                        psearchContainer.getPersistentSearchDecorator().setChangesOnly( changesOnly );
+                        container.getPersistentSearchDecorator().setChangesOnly( changesOnly );
                     }
                     catch ( BooleanDecoderException e )
                     {
@@ -182,12 +179,11 @@ public final class PersistentSearchGramm
         super.transitions[ PersistentSearchStates.CHANGES_ONLY_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] =
             new GrammarTransition( PersistentSearchStates.CHANGES_ONLY_STATE,
                                     PersistentSearchStates.RETURN_ECS_STATE, UniversalTag.BOOLEAN.getValue(),
-                new GrammarAction( "Set PSearchControl returnECs" )
+                new GrammarAction<PersistentSearchContainer>( "Set PSearchControl returnECs" )
             {
-                public void action( Asn1Container container ) throws DecoderException
+                public void action( PersistentSearchContainer container ) throws DecoderException
                 {
-                    PersistentSearchContainer psearchContainer = ( PersistentSearchContainer ) container;
-                    Value value = psearchContainer.getCurrentTLV().getValue();
+                    Value value = container.getCurrentTLV().getValue();
 
                     try
                     {
@@ -198,10 +194,10 @@ public final class PersistentSearchGramm
                             LOG.debug( "returnECs = " + returnECs );
                         }
 
-                        psearchContainer.getPersistentSearchDecorator().setReturnECs( returnECs );
+                        container.getPersistentSearchDecorator().setReturnECs( returnECs );
 
                         // We can have an END transition
-                        psearchContainer.setGrammarEndAllowed( true );
+                        container.setGrammarEndAllowed( true );
                     }
                     catch ( BooleanDecoderException e )
                     {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesContainer.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesContainer.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesContainer.java Sat Jan 29 08:23:02 2011
@@ -21,7 +21,6 @@ package org.apache.directory.shared.ldap
 
 
 import org.apache.directory.shared.asn1.ber.AbstractContainer;
-import org.apache.directory.shared.ldap.model.message.controls.Subentries;
 
 
 /**
@@ -54,32 +53,10 @@ public class SubentriesContainer extends
      * container, or if the Control already is a ControlDecorator it is directly
      * added.
      */
-    public SubentriesContainer( Subentries control )
+    public SubentriesContainer( SubentriesDecorator control )
     {
         this();
-        decorate( control );
-
-    }
-
-
-    /**
-     * Conditionally decorates the supplied Subentries Control if it is not already
-     * a decorator, and if already a decorator, then it is set as this container's
-     * ControlDecorator.
-     *
-     * @param control The Subentries Control to set if it is already a decorator, or
-     * if it is not already, the Control is decorated and set.
-     */
-    public void decorate( Subentries control )
-    {
-        if ( control instanceof SubentriesDecorator )
-        {
-            this.decorator = ( SubentriesDecorator ) control;
-        }
-        else
-        {
-            this.decorator = new SubentriesDecorator( control );
-        }
+        this.decorator = control;
     }
 
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesDecorator.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesDecorator.java Sat Jan 29 08:23:02 2011
@@ -22,7 +22,10 @@ package org.apache.directory.shared.ldap
 
 import java.nio.ByteBuffer;
 
+import org.apache.directory.shared.asn1.Asn1Object;
+import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.asn1.EncoderException;
+import org.apache.directory.shared.asn1.ber.Asn1Decoder;
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
@@ -38,8 +41,15 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class SubentriesDecorator extends ControlDecorator implements Subentries
+public class SubentriesDecorator extends ControlDecorator<Subentries> implements Subentries
 {
+    /** The encoded value of the control. */
+    private byte[] value;
+    
+    /** The sub entry decoder */
+    private static final Asn1Decoder decoder = new Asn1Decoder();
+
+    
     /**
      * Default constructor
      */
@@ -57,13 +67,7 @@ public class SubentriesDecorator extends
      */
     public SubentriesDecorator( Subentries control )
     {
-        super( control, new SubentriesDecoder() );
-    }
-
-
-    public Subentries getSubentries()
-    {
-        return ( Subentries ) getDecorated();
+        super( control );
     }
 
 
@@ -113,7 +117,7 @@ public class SubentriesDecorator extends
      */
     public byte[] getValue()
     {
-        if ( getDecorated().getValue() == null )
+        if ( value == null )
         {
             try
             { 
@@ -123,7 +127,7 @@ public class SubentriesDecorator extends
                 // Now encode the Subentries specific part
                 Value.encode( buffer, isVisible() );
                 
-                getDecorated().setValue( buffer.array() );
+                value = buffer.array();
             }
             catch ( Exception e )
             {
@@ -131,18 +135,28 @@ public class SubentriesDecorator extends
             }
         }
         
-        return getDecorated().getValue();
+        return value;
     }
 
 
     public boolean isVisible()
     {
-        return getSubentries().isVisible();
+        return getDecorated().isVisible();
     }
 
 
     public void setVisibility( boolean visibility )
     {
-        getSubentries().setVisibility( visibility );
+        getDecorated().setVisibility( visibility );
+    }
+
+
+    @Override
+    public Asn1Object decode( byte[] controlBytes ) throws DecoderException
+    {
+        ByteBuffer bb = ByteBuffer.wrap( controlBytes );
+        SubentriesContainer container = new SubentriesContainer( this );
+        decoder.decode( bb, container );
+        return this;
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesGrammar.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesGrammar.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesGrammar.java Sat Jan 29 08:23:02 2011
@@ -21,7 +21,6 @@ package org.apache.directory.shared.ldap
 
 
 import org.apache.directory.shared.asn1.DecoderException;
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.asn1.ber.grammar.AbstractGrammar;
 import org.apache.directory.shared.asn1.ber.grammar.Grammar;
 import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
@@ -65,13 +64,11 @@ public final class SubentriesGrammar ext
         super.transitions[ SubentriesStates.START_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] =
             new GrammarTransition( SubentriesStates.START_STATE,
                                     SubentriesStates.SUB_ENTRY_VISIBILITY_STATE, UniversalTag.BOOLEAN.getValue(),
-                new GrammarAction( "SubEntryControl visibility" )
+                new GrammarAction<SubentriesContainer>( "SubEntryControl visibility" )
             {
-                public void action( Asn1Container container ) throws DecoderException
+                public void action( SubentriesContainer container ) throws DecoderException
                 {
-                    SubentriesContainer subEntryContainer = ( SubentriesContainer ) container;
-
-                    TLV tlv = subEntryContainer.getCurrentTLV();
+                    TLV tlv = container.getCurrentTLV();
 
                     // We get the value. If it's a 0, it's a FALSE. If it's
                     // a FF, it's a TRUE. Any other value should be an error,
@@ -83,7 +80,7 @@ public final class SubentriesGrammar ext
 
                     try
                     {
-                        subEntryContainer.getSubentriesControl().setVisibility( BooleanDecoder.parse( value ) );
+                        container.getSubentriesControl().setVisibility( BooleanDecoder.parse( value ) );
 
                         // We can have an END transition
                         container.setGrammarEndAllowed( true );

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/constants/MetaSchemaConstants.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/constants/MetaSchemaConstants.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/constants/MetaSchemaConstants.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/constants/MetaSchemaConstants.java Sat Jan 29 08:23:02 2011
@@ -27,7 +27,6 @@ package org.apache.directory.shared.ldap
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 //This will suppress PMD.AvoidUsingHardCodedIP warnings in this class
-@SuppressWarnings("PMD.AvoidUsingHardCodedIP")
 public final class MetaSchemaConstants
 {
     /**

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/constants/SchemaConstants.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/constants/SchemaConstants.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/constants/SchemaConstants.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/constants/SchemaConstants.java Sat Jan 29 08:23:02 2011
@@ -28,8 +28,6 @@ package org.apache.directory.shared.ldap
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-//This will suppress PMD.AvoidUsingHardCodedIP warnings in this class
-@SuppressWarnings("PMD.AvoidUsingHardCodedIP")
 public final class SchemaConstants
 {
     /**

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntry.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntry.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntry.java Sat Jan 29 08:23:02 2011
@@ -42,7 +42,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
 import org.apache.directory.shared.util.Strings;
 import org.apache.directory.shared.util.Unicode;
-import org.apache.directory.shared.util.exception.NotImplementedException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -445,8 +444,6 @@ public class DefaultEntry implements Ent
      * We can't do it once as a static part in the body of this class, because
      * the access to the registries is mandatory to get back the AttributeType.
      */
-    // This will suppress PMD.EmptyCatchBlock warnings in this method
-    @SuppressWarnings("PMD.EmptyCatchBlock")
     private void initObjectClassAT()
     {
         try
@@ -963,6 +960,7 @@ public class DefaultEntry implements Ent
      * the original object won't affect the cloned object, as a modification
      * on the cloned object has no impact on the original object
      */
+    @SuppressWarnings("unchecked")
     public Entry clone()
     {
         try

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifControl.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifControl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifControl.java Sat Jan 29 08:23:02 2011
@@ -148,11 +148,6 @@ public class LdifControl implements Cont
             return false;
         }
 
-        if ( criticality != otherControl.isCritical() )
-        {
-            return false;
-        }
-
-        return hasValue() == otherControl.hasValue();
+        return criticality == otherControl.isCritical();
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifEntry.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifEntry.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifEntry.java Sat Jan 29 08:23:02 2011
@@ -30,13 +30,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
-import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.model.entry.*;
-import org.apache.directory.shared.ldap.model.entry.DefaultModification;
-import org.apache.directory.shared.ldap.model.entry.EntryAttribute;
-import org.apache.directory.shared.ldap.model.entry.Modification;
 import org.apache.directory.shared.ldap.model.entry.StringValue;
-import org.apache.directory.shared.ldap.model.entry.Value;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.model.message.Control;
@@ -89,7 +84,7 @@ public class LdifEntry implements Clonea
     private Entry entry;
 
     /** The controls */
-    private Map<String, Control> controls;
+    private Map<String, LdifControl> controls;
 
 
     /**
@@ -566,7 +561,7 @@ public class LdifEntry implements Clonea
     /**
      * @return The set of controls for this entry
      */
-    public Map<String, Control> getControls()
+    public Map<String, LdifControl> getControls()
     {
         return controls;
     }
@@ -576,7 +571,7 @@ public class LdifEntry implements Clonea
      * @param oid The control's OID
      * @return The associated control, if any
      */
-    public Control getControl( String oid )
+    public LdifControl getControl( String oid )
     {
         if ( controls != null )
         {
@@ -608,10 +603,10 @@ public class LdifEntry implements Clonea
     
             if ( this.controls == null )
             {
-                this.controls = new ConcurrentHashMap<String, Control>();
+                this.controls = new ConcurrentHashMap<String, LdifControl>();
             }
     
-            this.controls.put( control.getOid(), control );
+            this.controls.put( control.getOid(), ( LdifControl ) control );
         }
     }
 
@@ -909,7 +904,7 @@ public class LdifEntry implements Clonea
 
         if ( controls != null )
         {
-            Map<String, Control> otherControls = otherEntry.controls;
+            Map<String, LdifControl> otherControls = otherEntry.controls;
 
             if ( otherControls == null )
             {
@@ -1022,14 +1017,14 @@ public class LdifEntry implements Clonea
 
             if ( nbControls > 0 )
             {
-                controls = new ConcurrentHashMap<String, Control>( nbControls );
+                controls = new ConcurrentHashMap<String, LdifControl>( nbControls );
 
                 for ( int i = 0; i < nbControls; i++ )
                 {
                     String controlOid = in.readUTF();
                     boolean isCritical = in.readBoolean();
                     boolean hasValue = in.readBoolean();
-                    Control control = new LdifControl( controlOid );
+                    LdifControl control = new LdifControl( controlOid );
                     control.setCritical( isCritical );
 
                     if ( hasValue )
@@ -1126,7 +1121,7 @@ public class LdifEntry implements Clonea
             // Write the control
             out.writeInt( controls.size() );
 
-            for ( Control control : controls.values() )
+            for ( LdifControl control : controls.values() )
             {
                 Unicode.writeUTF(out, control.getOid());
                 out.writeBoolean( control.isCritical() );

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifUtils.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifUtils.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifUtils.java Sat Jan 29 08:23:02 2011
@@ -28,7 +28,6 @@ import org.apache.directory.shared.i18n.
 import org.apache.directory.shared.ldap.model.entry.*;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.exception.LdapInvalidAttributeValueException;
-import org.apache.directory.shared.ldap.model.message.Control;
 import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
@@ -375,7 +374,7 @@ public final class LdifUtils
             // First dump the controls if any
             if ( entry.hasControls() )
             {
-                for ( Control control : entry.getControls().values() )
+                for ( LdifControl control : entry.getControls().values() )
                 {
                     StringBuilder controlStr = new StringBuilder();
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/Control.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/Control.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/Control.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/Control.java Sat Jan 29 08:23:02 2011
@@ -50,28 +50,4 @@ public interface Control
      * @param isCritical true if the control is critical false otherwise.
      */
     void setCritical( boolean isCritical );
-    
-    
-    /**
-     * Returns the encoded value for this Control
-     *
-     * @return The encoded value
-     */
-    byte[] getValue();
-    
-    
-    /**
-     * Stores the encoded value for this Control
-     *
-     * @param value The encoded value
-     */
-    void setValue( byte[] value );
-    
-    
-    /**
-     * Tells if the Control has a value or not
-     *
-     * @return <code>true</code> if th Control has a value, even containing no bytes.
-     */
-    boolean hasValue();
 }

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/BasicControl.java (from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/BasicControlImpl.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/BasicControl.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/BasicControl.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/BasicControlImpl.java&r1=1064846&r2=1064981&rev=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/BasicControlImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/BasicControl.java Sat Jan 29 08:23:02 2011
@@ -17,11 +17,10 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.codec.controls;
+package org.apache.directory.shared.ldap.model.message.controls;
 
 
 import org.apache.directory.shared.ldap.model.message.Control;
-import org.apache.directory.shared.util.Strings;
 
 
 /**
@@ -29,7 +28,7 @@ import org.apache.directory.shared.util.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class BasicControlImpl implements Control
+public class BasicControl implements Control
 {
     /** The control type */
     private String oid;
@@ -37,16 +36,13 @@ public class BasicControlImpl implements
     /** The criticality (default value is false) */
     private boolean criticality = false;
 
-    /** Optional control value */
-    protected byte[] value;
-
 
     /**
      * Creates a Control with a specific OID.
      *
      * @param oid The OID of this Control.
      */
-    public BasicControlImpl( String oid )
+    public BasicControl( String oid )
     {
         this.oid = oid;
     }
@@ -62,37 +58,7 @@ public class BasicControlImpl implements
         return oid == null ? "" : oid;
     }
 
-
-    /**
-     * Get the control value
-     * 
-     * @return The control value
-     */
-    public byte[] getValue()
-    {
-        return value;
-    }
-
-
-    /**
-     * Set the encoded control value
-     * 
-     * @param value The encoded control value to store
-     */
-    public void setValue( byte[] value )
-    {
-        if ( value != null )
-        {
-            this.value = new byte[ value.length ];
-            System.arraycopy( value, 0, this.value, 0, value.length );
-        } 
-        else 
-        {
-            this.value = null;
-        }
-    }
-
-
+    
     /**
      * Get the criticality
      * 
@@ -116,15 +82,6 @@ public class BasicControlImpl implements
 
     
     /**
-     * {@inheritDoc}
-     */
-    public boolean hasValue()
-    {
-        return value != null;
-    }
-
-
-    /**
      * @see Object#equals(Object)
      */
     public boolean equals( Object o )
@@ -152,12 +109,7 @@ public class BasicControlImpl implements
         }
 
         //noinspection SimplifiableIfStatement
-        if ( criticality != otherControl.isCritical() )
-        {
-            return false;
-        }
-
-        return hasValue() == otherControl.hasValue();
+        return criticality == otherControl.isCritical();
     }
 
 
@@ -173,11 +125,7 @@ public class BasicControlImpl implements
         sb.append( "        Type OID    : '" ).append( oid ).append( "'\n" );
         sb.append( "        Criticality : '" ).append( criticality ).append( "'\n" );
 
-        if ( value != null )
-        {
-            sb.append( "        Value (HEX) : '" ).append( Strings.dumpBytes(value) )
-                .append( "'\n" );
-        }
+        sb.append( "'\n" );
 
         return sb.toString();
     }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/Cascade.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/Cascade.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/Cascade.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/Cascade.java Sat Jan 29 08:23:02 2011
@@ -19,7 +19,6 @@
 package org.apache.directory.shared.ldap.model.message.controls;
 
 
-import org.apache.directory.shared.ldap.codec.controls.BasicControlImpl;
 import org.apache.directory.shared.ldap.model.message.Control;
 
 
@@ -41,7 +40,7 @@ public interface Cascade extends Control
      *
      * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
      */
-    class SimpleCascade extends BasicControlImpl implements Cascade
+    class SimpleCascade extends BasicControl implements Cascade
     {
 
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/EntryChangeImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/EntryChangeImpl.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/EntryChangeImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/EntryChangeImpl.java Sat Jan 29 08:23:02 2011
@@ -20,7 +20,6 @@
 package org.apache.directory.shared.ldap.model.message.controls;
 
 
-import org.apache.directory.shared.ldap.codec.controls.BasicControlImpl;
 import org.apache.directory.shared.ldap.model.name.Dn;
 
 
@@ -29,7 +28,7 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class EntryChangeImpl extends BasicControlImpl implements EntryChange
+public class EntryChangeImpl extends BasicControl implements EntryChange
 {
 
     private ChangeType changeType = ChangeType.ADD;
@@ -90,7 +89,6 @@ public class EntryChangeImpl extends Bas
     /**
      * {@inheritDoc}
      */
-    @SuppressWarnings({"EqualsWhichDoesntCheckParameterClass"})
     @Override
     public boolean equals( Object o )
     {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/ManageDsaIT.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/ManageDsaIT.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/ManageDsaIT.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/ManageDsaIT.java Sat Jan 29 08:23:02 2011
@@ -19,7 +19,6 @@
 package org.apache.directory.shared.ldap.model.message.controls;
 
 
-import org.apache.directory.shared.ldap.codec.controls.BasicControlImpl;
 import org.apache.directory.shared.ldap.model.message.Control;
 
 
@@ -69,7 +68,7 @@ public interface ManageDsaIT extends Con
     ManageDsaIT INSTANCE = new SimpleManageDsaIT();
 
 
-    class SimpleManageDsaIT extends BasicControlImpl implements ManageDsaIT
+    class SimpleManageDsaIT extends BasicControl implements ManageDsaIT
     {
         /**
          * Default constructor.

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/PagedResultsImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/PagedResultsImpl.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/PagedResultsImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/PagedResultsImpl.java Sat Jan 29 08:23:02 2011
@@ -20,7 +20,6 @@
 package org.apache.directory.shared.ldap.model.message.controls;
 
 
-import org.apache.directory.shared.ldap.codec.controls.BasicControlImpl;
 import org.apache.directory.shared.util.StringConstants;
 import org.apache.directory.shared.util.Strings;
 
@@ -58,7 +57,7 @@ import java.util.Arrays;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class PagedResultsImpl extends BasicControlImpl implements PagedResults
+public class PagedResultsImpl extends BasicControl implements PagedResults
 {
 
     /** The number of entries to return, or returned */
@@ -133,7 +132,6 @@ public class PagedResultsImpl extends Ba
     /**
      * @see Object#equals(Object)
      */
-    @SuppressWarnings( { "EqualsWhichDoesntCheckParameterClass" } )
     @Override
     public boolean equals( Object o )
     {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/PersistentSearchImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/PersistentSearchImpl.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/PersistentSearchImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/PersistentSearchImpl.java Sat Jan 29 08:23:02 2011
@@ -20,7 +20,6 @@
 package org.apache.directory.shared.ldap.model.message.controls;
 
 
-import org.apache.directory.shared.ldap.codec.controls.BasicControlImpl;
 
 
 /**
@@ -28,7 +27,7 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class PersistentSearchImpl extends BasicControlImpl implements PersistentSearch
+public class PersistentSearchImpl extends BasicControl implements PersistentSearch
 {
 
     /**

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SubentriesImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SubentriesImpl.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SubentriesImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SubentriesImpl.java Sat Jan 29 08:23:02 2011
@@ -20,7 +20,6 @@
 package org.apache.directory.shared.ldap.model.message.controls;
 
 
-import org.apache.directory.shared.ldap.codec.controls.BasicControlImpl;
 
 
 /**
@@ -28,7 +27,7 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class SubentriesImpl extends BasicControlImpl implements Subentries
+public class SubentriesImpl extends BasicControl implements Subentries
 {
     private boolean visibility = false;
 

Added: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/ITestCodecControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/ITestCodecControl.java?rev=1064981&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/ITestCodecControl.java (added)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/ITestCodecControl.java Sat Jan 29 08:23:02 2011
@@ -0,0 +1,6 @@
+package org.apache.directory.shared.ldap.codec;
+
+
+interface ITestCodecControl extends ICodecControl<ITestControl>, ITestControl
+{
+}
\ No newline at end of file

Added: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/ITestControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/ITestControl.java?rev=1064981&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/ITestControl.java (added)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/ITestControl.java Sat Jan 29 08:23:02 2011
@@ -0,0 +1,18 @@
+package org.apache.directory.shared.ldap.codec;
+
+
+import org.apache.directory.shared.ldap.model.message.Control;
+
+
+interface ITestControl extends Control
+{
+
+    public static final String OID = "1.2.3.4.5";
+
+
+    public abstract int getFoo();
+
+
+    public abstract void setFoo( int foo );
+
+}
\ No newline at end of file

Added: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/TestCodecControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/TestCodecControl.java?rev=1064981&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/TestCodecControl.java (added)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/TestCodecControl.java Sat Jan 29 08:23:02 2011
@@ -0,0 +1,52 @@
+package org.apache.directory.shared.ldap.codec;
+
+
+import java.nio.ByteBuffer;
+
+import org.apache.directory.shared.asn1.EncoderException;
+
+
+public class TestCodecControl implements ITestCodecControl
+{
+    TestControl decorated = new TestControl();
+    
+    public String getOid()
+    {
+        return decorated.getOid();
+    }
+
+    public boolean isCritical()
+    {
+        return decorated.isCritical();
+    }
+
+    public void setCritical( boolean isCritical )
+    {
+        decorated.setCritical( isCritical );
+    }
+
+    public ITestControl getDecorated()
+    {
+        return decorated;
+    }
+
+    public int computeLength()
+    {
+        return 0;
+    }
+
+    public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
+    {
+        return null;
+    }
+
+    public int getFoo()
+    {
+        return decorated.getFoo();
+    }
+
+    public void setFoo( int foo )
+    {
+        decorated.setFoo( foo );
+    }
+}
\ No newline at end of file

Added: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/TestControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/TestControl.java?rev=1064981&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/TestControl.java (added)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/TestControl.java Sat Jan 29 08:23:02 2011
@@ -0,0 +1,39 @@
+package org.apache.directory.shared.ldap.codec;
+
+
+class TestControl implements ITestControl
+{
+    int foo;
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public int getFoo()
+    {
+        return foo;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void setFoo( int foo )
+    {
+        this.foo = foo;
+    }
+    
+    public String getOid()
+    {
+        return OID;
+    }
+
+    public boolean isCritical()
+    {
+        return true;
+    }
+
+    public void setCritical( boolean isCritical )
+    {
+    }
+}
\ No newline at end of file

Added: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/TestControlFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/TestControlFactory.java?rev=1064981&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/TestControlFactory.java (added)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/TestControlFactory.java Sat Jan 29 08:23:02 2011
@@ -0,0 +1,20 @@
+package org.apache.directory.shared.ldap.codec;
+
+
+public class TestControlFactory implements IControlFactory<ITestControl,ITestCodecControl>
+{
+    public String getOid()
+    {
+        return ITestControl.OID;
+    }
+
+    public ITestControl newControl()
+    {
+        return new TestCodecControl();
+    }
+
+    public ITestCodecControl newCodecControl()
+    {
+        return new TestCodecControl();
+    }
+}
\ No newline at end of file

Added: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/TestLdapCodecService.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/TestLdapCodecService.java?rev=1064981&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/TestLdapCodecService.java (added)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/TestLdapCodecService.java Sat Jan 29 08:23:02 2011
@@ -0,0 +1,112 @@
+package org.apache.directory.shared.ldap.codec;
+
+
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.directory.shared.ldap.model.message.Control;
+import org.apache.mina.filter.codec.ProtocolCodecFactory;
+
+
+public class TestLdapCodecService implements ILdapCodecService 
+{
+    Map<String,IControlFactory<?,?>> factories = new HashMap<String, IControlFactory<?,?>>();
+    
+    public void registerControl( IControlFactory<?,?> factory )
+    {
+        factories.put( factory.getOid(), factory );
+    }
+
+    
+    public void registerExtendedOp( IExtendedOpFactory<?, ?> factory )
+    {
+    }
+
+
+    public <E> E newCodecControl( Class<? extends ICodecControl<? extends Control>> clazz )
+    {
+        try
+        {
+            Field f = clazz.getField( "OID" );
+            String oid = ( String ) f.get( null );
+            IControlFactory<?,?> factory = factories.get( oid );
+            return extracted2( factory );
+        }
+        catch ( IllegalAccessException e )
+        {
+            e.printStackTrace();
+        }
+        catch ( SecurityException e )
+        {
+            e.printStackTrace();
+        }
+        catch ( NoSuchFieldException e )
+        {
+            e.printStackTrace();
+        }
+        
+        return null;
+    }
+
+    
+    public <E> E newControl( Class<? extends Control> clazz )
+    {
+        try
+        {
+            Field f = clazz.getField( "OID" );
+            String oid = ( String ) f.get( null );
+            IControlFactory<?,?> factory = factories.get( oid );
+            return extracted( factory );
+        }
+        catch ( IllegalAccessException e )
+        {
+            e.printStackTrace();
+        }
+        catch ( SecurityException e )
+        {
+            e.printStackTrace();
+        }
+        catch ( NoSuchFieldException e )
+        {
+            e.printStackTrace();
+        }
+        
+        return null;
+    }
+
+    
+    @SuppressWarnings("unchecked")
+    private <E> E extracted( IControlFactory<?,?> factory )
+    {
+        return ( E ) factory.newControl();
+    }
+
+    @SuppressWarnings("unchecked")
+    private <E> E extracted2( IControlFactory<?,?> factory )
+    {
+        return ( E ) factory.newCodecControl();
+    }
+
+    public Iterator<String> controlOids()
+    {
+        return null;
+    }
+
+    public Iterator<String> extendedRequestOids()
+    {
+        return null;
+    }
+
+    public Iterator<String> extendedResponseOids()
+    {
+        return null;
+    }
+
+
+    public ProtocolCodecFactory newProtocolCodecFactory( boolean client )
+    {
+        return null;
+    }
+}
\ No newline at end of file

Added: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/UseCaseTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/UseCaseTest.java?rev=1064981&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/UseCaseTest.java (added)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/UseCaseTest.java Sat Jan 29 08:23:02 2011
@@ -0,0 +1,53 @@
+/*
+ *   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;
+
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+
+/**
+ * Tests various use cases of a codec API.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class UseCaseTest
+{
+    @Test
+    public void testCodecControlUsage()
+    {
+        TestLdapCodecService codec = new TestLdapCodecService();
+        
+        codec.registerControl( new TestControlFactory() );
+        
+        ITestControl control = codec.newControl( TestControl.class );
+        control.setFoo( 24 );
+        
+        ITestCodecControl codecControl = codec.newCodecControl( TestCodecControl.class );
+        codecControl.setFoo( 12 );
+        
+        assertEquals( 24, control.getFoo() );
+        assertEquals( 12, codecControl.getFoo() );
+        assertEquals( 12, codecControl.getDecorated().getFoo() );
+    }
+}

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/abandon/AbandonRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/abandon/AbandonRequestTest.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/abandon/AbandonRequestTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/abandon/AbandonRequestTest.java Sat Jan 29 08:23:02 2011
@@ -20,7 +20,7 @@
 package org.apache.directory.shared.ldap.codec.abandon;
 
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertEquals; 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
@@ -31,13 +31,18 @@ import java.util.Map;
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
 import org.apache.directory.shared.asn1.ber.Asn1Decoder;
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.asn1.EncoderException;
+import org.apache.directory.shared.ldap.codec.DefaultLdapCodecService;
+import org.apache.directory.shared.ldap.codec.ICodecControl;
+import org.apache.directory.shared.ldap.codec.ILdapCodecService;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.model.message.AbandonRequest;
 import org.apache.directory.shared.ldap.model.message.AbandonRequestImpl;
+import org.apache.directory.shared.ldap.model.message.Message;
 import org.apache.directory.shared.ldap.codec.LdapEncoder;
+import org.apache.directory.shared.ldap.codec.decorators.AbandonRequestDecorator;
+import org.apache.directory.shared.ldap.codec.decorators.MessageDecorator;
 import org.apache.directory.shared.ldap.model.message.Control;
 import org.apache.directory.shared.util.Strings;
 import org.junit.Test;
@@ -55,6 +60,8 @@ public class AbandonRequestTest
 {
     /** The encoder instance */
     LdapEncoder encoder = new LdapEncoder();
+    
+    ILdapCodecService codec = new DefaultLdapCodecService();
 
 
     /**
@@ -93,7 +100,8 @@ public class AbandonRequestTest
         stream.flip();
 
         // Allocate a LdapMessageContainer Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<AbandonRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<AbandonRequestDecorator>( codec );
 
         // Decode the PDU
         try
@@ -107,7 +115,7 @@ public class AbandonRequestTest
         }
 
         // Check that everything is OK
-        AbandonRequest abandonRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getAbandonRequest();
+        AbandonRequestDecorator abandonRequest = ldapMessageContainer.getMessage();
 
         // Copy the message
         AbandonRequest internalAbandonRequest = new AbandonRequestImpl( abandonRequest.getMessageId() );
@@ -121,25 +129,25 @@ public class AbandonRequestTest
 
         assertEquals( 4, controls.size() );
 
-        Control control = controls.get( "1.3.6.1.5.5.1" );
+        ICodecControl<? extends Control> control = ( ICodecControl<?> ) controls.get( "1.3.6.1.5.5.1" );
         assertEquals( "1.3.6.1.5.5.1", control.getOid() );
-        assertEquals( "0x61 0x62 0x63 0x64 0x65 0x66 ", Strings.dumpBytes((byte[]) control.getValue()) );
+        assertEquals( "0x61 0x62 0x63 0x64 0x65 0x66 ", Strings.dumpBytes( ( byte[] ) control.getValue() ) );
         assertTrue( control.isCritical() );
         internalAbandonRequest.addControl( control );
 
-        control = controls.get( "1.3.6.1.5.5.2" );
+        control = ( ICodecControl<?> ) controls.get( "1.3.6.1.5.5.2" );
         assertEquals( "1.3.6.1.5.5.2", control.getOid() );
-        assertEquals( "0x67 0x68 0x69 0x6A 0x6B 0x6C ", Strings.dumpBytes((byte[]) control.getValue()) );
+        assertEquals( "0x67 0x68 0x69 0x6A 0x6B 0x6C ", Strings.dumpBytes( ( byte[] ) control.getValue() ) );
         assertFalse( control.isCritical() );
         internalAbandonRequest.addControl( control );
 
-        control = controls.get( "1.3.6.1.5.5.3" );
+        control = ( ICodecControl<?> ) controls.get( "1.3.6.1.5.5.3" );
         assertEquals( "1.3.6.1.5.5.3", control.getOid() );
         assertEquals( "", Strings.dumpBytes((byte[]) control.getValue()) );
         assertTrue( control.isCritical() );
         internalAbandonRequest.addControl( control );
 
-        control = controls.get( "1.3.6.1.5.5.4" );
+        control = ( ICodecControl<?> ) controls.get( "1.3.6.1.5.5.4" );
         assertEquals( "1.3.6.1.5.5.4", control.getOid() );
         assertEquals( "", Strings.dumpBytes((byte[]) control.getValue()) );
         assertFalse( control.isCritical() );
@@ -165,9 +173,7 @@ public class AbandonRequestTest
                 fail( de.getMessage() );
             }
 
-            AbandonRequest abandonRequest2 = ( ( LdapMessageContainer ) ldapMessageContainer )
-                .getAbandonRequest();
-
+            AbandonRequest abandonRequest2 = ldapMessageContainer.getMessage();
             assertEquals( abandonRequest, abandonRequest2 );
         }
         catch ( EncoderException ee )
@@ -199,7 +205,8 @@ public class AbandonRequestTest
         stream.flip();
 
         // Allocate a LdapMessageContainer Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<AbandonRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<AbandonRequestDecorator>( codec );
 
         // Decode the PDU
         try
@@ -213,7 +220,7 @@ public class AbandonRequestTest
         }
 
         // Check that everything is OK
-        AbandonRequest abandonRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getAbandonRequest();
+        AbandonRequest abandonRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 32787, abandonRequest.getMessageId() );
         assertEquals( 2, abandonRequest.getAbandoned() );
@@ -261,7 +268,8 @@ public class AbandonRequestTest
         stream.flip();
 
         // Allocate a LdapMessageContainer Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<MessageDecorator<? extends Message>> ldapMessageContainer = 
+            new LdapMessageContainer<MessageDecorator<? extends Message>>( codec );
 
         // Decode the PDU
         try
@@ -297,7 +305,8 @@ public class AbandonRequestTest
         stream.flip();
 
         // Allocate a LdapMessageContainer Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<MessageDecorator<? extends Message>> ldapMessageContainer = 
+            new LdapMessageContainer<MessageDecorator<? extends Message>>( codec );
 
         // Decode the PDU
         try

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncRequestValueControlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncRequestValueControlTest.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncRequestValueControlTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncRequestValueControlTest.java Sat Jan 29 08:23:02 2011
@@ -31,9 +31,9 @@ import org.apache.directory.junit.tools.
 import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.asn1.EncoderException;
 import org.apache.directory.shared.asn1.ber.Asn1Decoder;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueControl;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueControlContainer;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueControlDecoder;
+import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueDecorator;
+import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueContainer;
+import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueDecorator;
 import org.apache.directory.shared.ldap.message.control.replication.SynchronizationModeEnum;
 import org.apache.directory.shared.util.Strings;
 import org.junit.Test;
@@ -67,8 +67,8 @@ public class SyncRequestValueControlTest
             } );
         bb.flip();
 
-        SyncRequestValueControlContainer container = new SyncRequestValueControlContainer();
-        container.setSyncRequestValueControl( new SyncRequestValueControl() );
+        SyncRequestValueContainer container = new SyncRequestValueContainer();
+        container.setSyncRequestValueControl( new SyncRequestValueDecorator() );
         
         try
         {
@@ -80,7 +80,7 @@ public class SyncRequestValueControlTest
             fail( de.getMessage() );
         }
 
-        SyncRequestValueControl syncRequestValue = container.getSyncRequestValueControl();
+        SyncRequestValueDecorator syncRequestValue = container.getSyncRequestValueControl();
         assertEquals( SynchronizationModeEnum.REFRESH_ONLY, syncRequestValue.getMode() );
         assertEquals( "abc", Strings.utf8ToString(syncRequestValue.getCookie()) );
         assertEquals( false, syncRequestValue.isReloadHint() );
@@ -136,8 +136,8 @@ public class SyncRequestValueControlTest
             } );
         bb.flip();
 
-        SyncRequestValueControlContainer container = new SyncRequestValueControlContainer();
-        container.setSyncRequestValueControl( new SyncRequestValueControl() );
+        SyncRequestValueContainer container = new SyncRequestValueContainer();
+        container.setSyncRequestValueControl( new SyncRequestValueDecorator() );
 
         try
         {
@@ -149,7 +149,7 @@ public class SyncRequestValueControlTest
             fail( de.getMessage() );
         }
 
-        SyncRequestValueControl syncRequestValue = container.getSyncRequestValueControl();
+        SyncRequestValueDecorator syncRequestValue = container.getSyncRequestValueControl();
         assertEquals( SynchronizationModeEnum.REFRESH_AND_PERSIST, syncRequestValue.getMode() );
         assertEquals( "abc", Strings.utf8ToString(syncRequestValue.getCookie()) );
         assertEquals( false, syncRequestValue.isReloadHint() );
@@ -204,8 +204,8 @@ public class SyncRequestValueControlTest
             } );
         bb.flip();
 
-        SyncRequestValueControlContainer container = new SyncRequestValueControlContainer();
-        container.setSyncRequestValueControl( new SyncRequestValueControl() );
+        SyncRequestValueContainer container = new SyncRequestValueContainer();
+        container.setSyncRequestValueControl( new SyncRequestValueDecorator() );
 
         try
         {
@@ -217,7 +217,7 @@ public class SyncRequestValueControlTest
             fail( de.getMessage() );
         }
 
-        SyncRequestValueControl syncRequestValue = container.getSyncRequestValueControl();
+        SyncRequestValueDecorator syncRequestValue = container.getSyncRequestValueControl();
         assertEquals( SynchronizationModeEnum.REFRESH_AND_PERSIST, syncRequestValue.getMode() );
         assertNull( syncRequestValue.getCookie() );
         assertEquals( false, syncRequestValue.isReloadHint() );
@@ -272,8 +272,8 @@ public class SyncRequestValueControlTest
             } );
         bb.flip();
 
-        SyncRequestValueControlContainer container = new SyncRequestValueControlContainer();
-        container.setSyncRequestValueControl( new SyncRequestValueControl() );
+        SyncRequestValueContainer container = new SyncRequestValueContainer();
+        container.setSyncRequestValueControl( new SyncRequestValueDecorator() );
 
         try
         {
@@ -285,7 +285,7 @@ public class SyncRequestValueControlTest
             fail( de.getMessage() );
         }
 
-        SyncRequestValueControl syncRequestValue = container.getSyncRequestValueControl();
+        SyncRequestValueDecorator syncRequestValue = container.getSyncRequestValueControl();
         assertEquals( SynchronizationModeEnum.REFRESH_AND_PERSIST, syncRequestValue.getMode() );
         assertNull( syncRequestValue.getCookie() );
         assertEquals( true, syncRequestValue.isReloadHint() );
@@ -340,8 +340,8 @@ public class SyncRequestValueControlTest
             } );
         bb.flip();
 
-        SyncRequestValueControlContainer container = new SyncRequestValueControlContainer();
-        container.setSyncRequestValueControl( new SyncRequestValueControl() );
+        SyncRequestValueContainer container = new SyncRequestValueContainer();
+        container.setSyncRequestValueControl( new SyncRequestValueDecorator() );
 
         try
         {
@@ -353,7 +353,7 @@ public class SyncRequestValueControlTest
             fail( de.getMessage() );
         }
 
-        SyncRequestValueControl syncRequestValue = container.getSyncRequestValueControl();
+        SyncRequestValueDecorator syncRequestValue = container.getSyncRequestValueControl();
         assertEquals( SynchronizationModeEnum.REFRESH_AND_PERSIST, syncRequestValue.getMode() );
         assertNull( syncRequestValue.getCookie() );
         assertEquals( false, syncRequestValue.isReloadHint() );
@@ -407,8 +407,8 @@ public class SyncRequestValueControlTest
             } );
         bb.flip();
 
-        SyncRequestValueControlContainer container = new SyncRequestValueControlContainer();
-        container.setSyncRequestValueControl( new SyncRequestValueControl() );
+        SyncRequestValueContainer container = new SyncRequestValueContainer();
+        container.setSyncRequestValueControl( new SyncRequestValueDecorator() );
 
         try
         {
@@ -420,7 +420,7 @@ public class SyncRequestValueControlTest
             fail( de.getMessage() );
         }
 
-        SyncRequestValueControl syncRequestValue = container.getSyncRequestValueControl();
+        SyncRequestValueDecorator syncRequestValue = container.getSyncRequestValueControl();
         assertEquals( SynchronizationModeEnum.REFRESH_AND_PERSIST, syncRequestValue.getMode() );
         assertEquals( "abc", Strings.utf8ToString(syncRequestValue.getCookie()) );
         assertEquals( false, syncRequestValue.isReloadHint() );
@@ -475,8 +475,8 @@ public class SyncRequestValueControlTest
             } );
         bb.flip();
 
-        SyncRequestValueControlContainer container = new SyncRequestValueControlContainer();
-        container.setSyncRequestValueControl( new SyncRequestValueControl() );
+        SyncRequestValueContainer container = new SyncRequestValueContainer();
+        container.setSyncRequestValueControl( new SyncRequestValueDecorator() );
 
         try
         {
@@ -488,7 +488,7 @@ public class SyncRequestValueControlTest
             fail( de.getMessage() );
         }
 
-        SyncRequestValueControl syncRequestValue = container.getSyncRequestValueControl();
+        SyncRequestValueDecorator syncRequestValue = container.getSyncRequestValueControl();
         assertEquals( SynchronizationModeEnum.REFRESH_AND_PERSIST, syncRequestValue.getMode() );
         assertEquals( "", Strings.utf8ToString(syncRequestValue.getCookie()) );
         assertEquals( false, syncRequestValue.isReloadHint() );
@@ -538,8 +538,8 @@ public class SyncRequestValueControlTest
             } );
         bb.flip();
 
-        SyncRequestValueControlContainer container = new SyncRequestValueControlContainer();
-        container.setSyncRequestValueControl( new SyncRequestValueControl() );
+        SyncRequestValueContainer container = new SyncRequestValueContainer();
+        container.setSyncRequestValueControl( new SyncRequestValueDecorator() );
 
         try
         {
@@ -568,8 +568,8 @@ public class SyncRequestValueControlTest
             } );
         bb.flip();
 
-        SyncRequestValueControlContainer container = new SyncRequestValueControlContainer();
-        container.setSyncRequestValueControl( new SyncRequestValueControl() );
+        SyncRequestValueContainer container = new SyncRequestValueContainer();
+        container.setSyncRequestValueControl( new SyncRequestValueDecorator() );
 
         try
         {



Mime
View raw message