directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r1064981 [5/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/controls/ControlDecoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlDecoder.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlDecoder.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlDecoder.java Sat Jan 29 08:23:02 2011
@@ -30,15 +30,14 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public interface ControlDecoder
+public interface ControlDecoder<E extends Control>
 {
     /**
      * Decodes raw ASN.1 encoded bytes into an Asn1Object for the control.
      * 
      * @param controlBytes the encoded control bytes
-     * @param control The control to feed
      * @return the decoded Asn1Object for the control
      * @throws DecoderException if anything goes wrong
      */
-    Asn1Object decode( byte[] controlBytes, Control control ) throws DecoderException;
+    Asn1Object decode( byte[] controlBytes ) throws DecoderException;
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlDecorator.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlDecorator.java Sat Jan 29 08:23:02 2011
@@ -21,11 +21,14 @@ package org.apache.directory.shared.ldap
 
 
 import org.apache.directory.shared.asn1.AbstractAsn1Object;
+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.tlv.TLV;
 import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
 import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.codec.ICodecControl;
 import org.apache.directory.shared.ldap.model.message.Control;
 import org.apache.directory.shared.util.Strings;
 
@@ -39,11 +42,12 @@ import java.nio.ByteBuffer;
  * decorator while processing.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @param <E>
  */
-public class ControlDecorator extends AbstractAsn1Object implements Control, CodecControl
+public abstract class ControlDecorator<E extends Control> extends AbstractAsn1Object implements Control, ICodecControl<E>
 {
     /** The decorated Control */
-    private final Control decorated;
+    private E decorated;
 
     /** The encoded value length */
     protected int valueLength;
@@ -51,31 +55,18 @@ public class ControlDecorator extends Ab
     /** The control length */
     private int controlLength;
 
-    /** The control decoder */
-    private ControlDecoder decoder;
-
-
-    /**
-     * Creates a ControlDecorator to codec enable it.
-     *
-     * @param decoratedControl The Control to decorate.
-     */
-    public ControlDecorator( Control decoratedControl )
-    {
-        this.decorated = decoratedControl;
-    }
-
+    /** The encoded value of the control. */
+    private byte[] value;
 
+    
     /**
      * Creates a ControlDecorator to codec enable it.
      *
      * @param decoratedControl The Control to decorate.
-     * @param decoder The Control's decoder.
      */
-    public ControlDecorator( Control decoratedControl, ControlDecoder decoder )
+    public ControlDecorator( E decoratedControl )
     {
         this.decorated = decoratedControl;
-        this.decoder = decoder;
     }
 
 
@@ -108,7 +99,7 @@ public class ControlDecorator extends Ab
     }
 
 
-    public Control getDecorated()
+    public E getDecorated()
     {
         return decorated;
     }
@@ -135,7 +126,7 @@ public class ControlDecorator extends Ab
      */
     public boolean hasValue()
     {
-        return decorated.hasValue();
+        return value != null;
     }
 
 
@@ -146,7 +137,7 @@ public class ControlDecorator extends Ab
      */
     public byte[] getValue()
     {
-        return decorated.getValue();
+        return value;
     }
 
 
@@ -161,11 +152,11 @@ public class ControlDecorator extends Ab
         {
             byte[] copy = new byte[ value.length ];
             System.arraycopy( value, 0, copy, 0, value.length );
-            decorated.setValue( copy );
+            value = copy;
         } 
         else 
         {
-            decorated.setValue( null );
+            value = null;
         }
     }
 
@@ -242,15 +233,6 @@ public class ControlDecorator extends Ab
     }
 
 
-    /**
-     * {@inheritDoc}
-     */
-    public ControlDecoder getDecoder()
-    {
-        return decoder;
-    }
-
-
     // ------------------------------------------------------------------------
     // Object Method Overrides
     // ------------------------------------------------------------------------
@@ -284,12 +266,7 @@ public class ControlDecorator extends Ab
         }
 
         //noinspection SimplifiableIfStatement
-        if ( otherControl.isCritical() != isCritical() )
-        {
-            return false;
-        }
-
-        return hasValue() == otherControl.hasValue();
+        return otherControl.isCritical() == isCritical();
     }
 
 
@@ -300,4 +277,7 @@ public class ControlDecorator extends Ab
     {
         return decorated.toString();
     }
+
+    
+    public abstract Asn1Object decode( byte[] controlBytes ) throws DecoderException;
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITDecorator.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITDecorator.java Sat Jan 29 08:23:02 2011
@@ -20,6 +20,8 @@
 package org.apache.directory.shared.ldap.codec.controls;
 
 
+import org.apache.directory.shared.asn1.Asn1Object;
+import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.ldap.model.message.controls.ManageDsaIT;
 
 
@@ -28,11 +30,13 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ManageDsaITDecorator extends ControlDecorator implements ManageDsaIT
+public class ManageDsaITDecorator extends ControlDecorator<ManageDsaIT> implements ManageDsaIT
 {
     // @TODO We should not bother encoding and decoding marker controls that always
     // encode and decode into the same TLV/byte sequence. Can't the control just
     // supply the canned PDU element?
+    //
+    // override the decorator component to hard code this control?
 
 
     /**
@@ -40,7 +44,7 @@ public class ManageDsaITDecorator extend
      */
     public ManageDsaITDecorator()
     {
-        super( ManageDsaIT.INSTANCE, new ManageDsaITDecoder() );
+        super( ManageDsaIT.INSTANCE );
     }
 
 
@@ -52,4 +56,10 @@ public class ManageDsaITDecorator extend
         // Call the super class to compute the global control length
         return super.computeLength( 0 );
     }
+    
+
+    public Asn1Object decode( byte[] controlBytes ) throws DecoderException  
+    {
+        return this;
+    }
 }

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/ISyncRequestValue.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/ISyncRequestValue.java?rev=1064981&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/ISyncRequestValue.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/ISyncRequestValue.java Sat Jan 29 08:23:02 2011
@@ -0,0 +1,74 @@
+/*
+ *  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.replication.syncRequestValue;
+
+
+import org.apache.directory.shared.ldap.message.control.replication.SynchronizationModeEnum;
+import org.apache.directory.shared.ldap.model.message.Control;
+
+
+/**
+ * A syncRequestValue object, as defined in RFC 4533
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public interface ISyncRequestValue extends Control
+{
+
+    /** This control OID */
+    public static final String OID = "1.3.6.1.4.1.4203.1.9.1.1";
+
+
+    /**
+     * @return the mode
+     */
+    public abstract SynchronizationModeEnum getMode();
+
+
+    /**
+     * @param syncMode the syncMode to set
+     */
+    public abstract void setMode( SynchronizationModeEnum mode );
+
+
+    /**
+     * @return the cookie
+     */
+    public abstract byte[] getCookie();
+
+
+    /**
+     * @param cookie the cookie to set
+     */
+    public abstract void setCookie( byte[] cookie );
+
+
+    /**
+     * @return the reloadHint
+     */
+    public abstract boolean isReloadHint();
+
+
+    /**
+     * @param reloadHint the reloadHint to set
+     */
+    public abstract void setReloadHint( boolean reloadHint );
+
+}
\ No newline at end of file

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValue.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValue.java?rev=1064981&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValue.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValue.java Sat Jan 29 08:23:02 2011
@@ -0,0 +1,119 @@
+/*
+ *   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.replication.syncRequestValue;
+
+
+import org.apache.directory.shared.ldap.message.control.replication.SynchronizationModeEnum;
+
+
+/**
+ * A syncRequestValue object, as defined in RFC 4533
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SyncRequestValue implements ISyncRequestValue
+{
+    private boolean isCritical;
+    private byte[] cookie;
+    private SynchronizationModeEnum mode;
+    private boolean isReloadHint;
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String getOid()
+    {
+        return OID;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical()
+    {
+        return isCritical;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setCritical( boolean isCritical )
+    {
+        this.isCritical = isCritical;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public byte[] getCookie()
+    {
+        return this.cookie;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setCookie( byte[] cookie )
+    {
+        this.cookie = cookie;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public SynchronizationModeEnum getMode()
+    {
+        return mode;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setMode( SynchronizationModeEnum mode )
+    {
+        this.mode = mode;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isReloadHint()
+    {
+        return isReloadHint;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setReloadHint( boolean reloadHint )
+    {
+        this.isReloadHint = reloadHint;
+    }
+}

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueContainer.java (from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlContainer.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueContainer.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueContainer.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlContainer.java&r1=1064846&r2=1064981&rev=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlContainer.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueContainer.java Sat Jan 29 08:23:02 2011
@@ -28,29 +28,43 @@ import org.apache.directory.shared.asn1.
  *  
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class SyncRequestValueControlContainer extends AbstractContainer
+public class SyncRequestValueContainer extends AbstractContainer
 {
     /** SyncRequestValueControl */
-    private SyncRequestValueControl control;
+    private SyncRequestValueDecorator control;
 
 
     /**
      * Creates a new SyncRequestValueControlContainer object. We will store one grammar,
      * it's enough ...
      */
-    public SyncRequestValueControlContainer()
+    public SyncRequestValueContainer()
     {
         super();
         stateStack = new int[1];
-        grammar = SyncRequestValueControlGrammar.getInstance();
-        setTransition( SyncRequestValueControlStatesEnum.START_STATE );
+        grammar = SyncRequestValueGrammar.getInstance();
+        setTransition( SyncRequestValueStatesEnum.START_STATE );
+    }
+
+
+    /**
+     * Creates a new SyncRequestValueControlContainer object. We will store one grammar,
+     * it's enough ...
+     */
+    public SyncRequestValueContainer( SyncRequestValueDecorator control )
+    {
+        super();
+        this.control = control;
+        stateStack = new int[1];
+        grammar = SyncRequestValueGrammar.getInstance();
+        setTransition( SyncRequestValueStatesEnum.START_STATE );
     }
 
 
     /**
      * @return Returns the syncRequestValue control.
      */
-    public SyncRequestValueControl getSyncRequestValueControl()
+    public ISyncRequestValue getSyncRequestValueControl()
     {
         return control;
     }
@@ -62,7 +76,7 @@ public class SyncRequestValueControlCont
      * 
      * @param control the SyncRequestValueControl to set.
      */
-    public void setSyncRequestValueControl( SyncRequestValueControl control )
+    public void setSyncRequestValueControl( SyncRequestValueDecorator control )
     {
         this.control = control;
     }

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueDecorator.java (from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControl.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueDecorator.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueDecorator.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControl.java&r1=1064846&r2=1064981&rev=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueDecorator.java Sat Jan 29 08:23:02 2011
@@ -19,28 +19,30 @@
  */
 package org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue;
 
+
 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;
 import org.apache.directory.shared.i18n.I18n;
-import org.apache.directory.shared.ldap.codec.controls.AbstractControl;
+import org.apache.directory.shared.ldap.codec.controls.ControlDecorator;
 import org.apache.directory.shared.ldap.message.control.replication.SynchronizationModeEnum;
 import org.apache.directory.shared.util.Strings;
 
+
 /**
  * A syncRequestValue object, as defined in RFC 4533
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class SyncRequestValueControl  extends AbstractControl
+public class SyncRequestValueDecorator  extends ControlDecorator<ISyncRequestValue> implements ISyncRequestValue
 {
-    /** This control OID */
-    public static final String CONTROL_OID = "1.3.6.1.4.1.4203.1.9.1.1";
-
     /** The synchronization type */
     private SynchronizationModeEnum mode;
     
@@ -53,15 +55,27 @@ public class SyncRequestValueControl  ex
     /** The global length for this control */
     private int syncRequestValueLength;
     
-    public SyncRequestValueControl()
+    /** The opaque value of the control */
+    private byte[] value;
+
+    /** An instance of this decoder */
+    private static final Asn1Decoder decoder = new Asn1Decoder();
+
+    
+    public SyncRequestValueDecorator()
     {
-        super( CONTROL_OID );
+        super( new SyncRequestValue() );
+    }
 
-        decoder = new SyncRequestValueControlDecoder();
+    
+    public SyncRequestValueDecorator( ISyncRequestValue control )
+    {
+        super( control );
     }
 
+    
     /**
-     * @return the mode
+     * {@inheritDoc}
      */
     public SynchronizationModeEnum getMode()
     {
@@ -70,7 +84,7 @@ public class SyncRequestValueControl  ex
 
     
     /**
-     * @param syncMode the syncMode to set
+     * {@inheritDoc}
      */
     public void setMode( SynchronizationModeEnum mode )
     {
@@ -79,7 +93,7 @@ public class SyncRequestValueControl  ex
 
     
     /**
-     * @return the cookie
+     * {@inheritDoc}
      */
     public byte[] getCookie()
     {
@@ -88,7 +102,7 @@ public class SyncRequestValueControl  ex
 
     
     /**
-     * @param cookie the cookie to set
+     * {@inheritDoc}
      */
     public void setCookie( byte[] cookie )
     {
@@ -97,7 +111,7 @@ public class SyncRequestValueControl  ex
 
     
     /**
-     * @return the reloadHint
+     * {@inheritDoc}
      */
     public boolean isReloadHint()
     {
@@ -106,7 +120,7 @@ public class SyncRequestValueControl  ex
 
     
     /**
-     * @param reloadHint the reloadHint to set
+     * {@inheritDoc}
      */
     public void setReloadHint( boolean reloadHint )
     {
@@ -251,7 +265,7 @@ public class SyncRequestValueControl  ex
             return false;
         }
 
-        SyncRequestValueControl otherControl = ( SyncRequestValueControl ) o;
+        SyncRequestValueDecorator otherControl = ( SyncRequestValueDecorator ) o;
         
         return ( mode == otherControl.mode ) && 
             ( reloadHint == otherControl.reloadHint ) &&
@@ -276,4 +290,14 @@ public class SyncRequestValueControl  ex
 
         return sb.toString();
     }
+    
+
+    @Override
+    public Asn1Object decode( byte[] controlBytes ) throws DecoderException
+    {
+        ByteBuffer bb = ByteBuffer.wrap( controlBytes );
+        SyncRequestValueContainer container = new SyncRequestValueContainer( this );
+        decoder.decode( bb, container );
+        return this;
+    }
 }

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueGrammar.java (from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlGrammar.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueGrammar.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueGrammar.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlGrammar.java&r1=1064846&r2=1064981&rev=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlGrammar.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueGrammar.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;
@@ -55,27 +54,27 @@ import org.slf4j.LoggerFactory;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public final class SyncRequestValueControlGrammar extends AbstractGrammar
+public final class SyncRequestValueGrammar extends AbstractGrammar
 {
     /** The logger */
-    static final Logger LOG = LoggerFactory.getLogger( SyncRequestValueControlGrammar.class );
+    static final Logger LOG = LoggerFactory.getLogger( SyncRequestValueGrammar.class );
 
     /** Speedup for logs */
     static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     /** The instance of grammar. SyncRequestValueControlGrammar is a singleton */
-    private static Grammar instance = new SyncRequestValueControlGrammar();
+    private static Grammar instance = new SyncRequestValueGrammar();
 
 
     /**
      * Creates a new SyncRequestValueControlGrammar object.
      */
-    private SyncRequestValueControlGrammar()
+    private SyncRequestValueGrammar()
     {
-        setName( SyncRequestValueControlGrammar.class.getName() );
+        setName( SyncRequestValueGrammar.class.getName() );
 
         // Create the transitions table
-        super.transitions = new GrammarTransition[SyncRequestValueControlStatesEnum.LAST_SYNC_REQUEST_VALUE_STATE.ordinal()][256];
+        super.transitions = new GrammarTransition[SyncRequestValueStatesEnum.LAST_SYNC_REQUEST_VALUE_STATE.ordinal()][256];
 
         /** 
          * Transition from initial state to SyncRequestValue sequence
@@ -84,9 +83,9 @@ public final class SyncRequestValueContr
          *     
          * Initialize the syncRequestValue object
          */
-        super.transitions[SyncRequestValueControlStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = 
-            new GrammarTransition( SyncRequestValueControlStatesEnum.START_STATE, 
-                                    SyncRequestValueControlStatesEnum.SYNC_REQUEST_VALUE_SEQUENCE_STATE, 
+        super.transitions[SyncRequestValueStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = 
+            new GrammarTransition( SyncRequestValueStatesEnum.START_STATE, 
+                                    SyncRequestValueStatesEnum.SYNC_REQUEST_VALUE_SEQUENCE_STATE, 
                                     UniversalTag.SEQUENCE.getValue(), 
                 null );
 
@@ -104,16 +103,15 @@ public final class SyncRequestValueContr
          *     
          * Stores the mode value
          */
-        super.transitions[SyncRequestValueControlStatesEnum.SYNC_REQUEST_VALUE_SEQUENCE_STATE.ordinal()][UniversalTag.ENUMERATED.getValue()] = 
-            new GrammarTransition( SyncRequestValueControlStatesEnum.SYNC_REQUEST_VALUE_SEQUENCE_STATE, 
-                SyncRequestValueControlStatesEnum.MODE_STATE, 
+        super.transitions[SyncRequestValueStatesEnum.SYNC_REQUEST_VALUE_SEQUENCE_STATE.ordinal()][UniversalTag.ENUMERATED.getValue()] = 
+            new GrammarTransition( SyncRequestValueStatesEnum.SYNC_REQUEST_VALUE_SEQUENCE_STATE, 
+                SyncRequestValueStatesEnum.MODE_STATE, 
                 UniversalTag.ENUMERATED.getValue(),
-                new GrammarAction( "Set SyncRequestValueControl mode" )
+                new GrammarAction<SyncRequestValueContainer>( "Set SyncRequestValueControl mode" )
             {
-                public void action( Asn1Container container ) throws DecoderException
+                public void action( SyncRequestValueContainer container ) throws DecoderException
                 {
-                    SyncRequestValueControlContainer syncRequestValueContainer = ( SyncRequestValueControlContainer ) container;
-                    Value value = syncRequestValueContainer.getCurrentTLV().getValue();
+                    Value value = container.getCurrentTLV().getValue();
 
                     try
                     {
@@ -129,10 +127,10 @@ public final class SyncRequestValueContr
                             LOG.debug( "Mode = " + modeEnum );
                         }
 
-                        syncRequestValueContainer.getSyncRequestValueControl().setMode( modeEnum );
+                        container.getSyncRequestValueControl().setMode( modeEnum );
 
                         // We can have an END transition
-                        syncRequestValueContainer.setGrammarEndAllowed( true );
+                        container.setGrammarEndAllowed( true );
                     }
                     catch ( IntegerDecoderException e )
                     {
@@ -153,15 +151,14 @@ public final class SyncRequestValueContr
          *     
          * Stores the cookie
          */
-        super.transitions[SyncRequestValueControlStatesEnum.MODE_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = 
-            new GrammarTransition( SyncRequestValueControlStatesEnum.MODE_STATE,
-                                    SyncRequestValueControlStatesEnum.COOKIE_STATE, UniversalTag.OCTET_STRING.getValue(),
-                new GrammarAction( "Set SyncRequestValueControl cookie" )
+        super.transitions[SyncRequestValueStatesEnum.MODE_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = 
+            new GrammarTransition( SyncRequestValueStatesEnum.MODE_STATE,
+                                    SyncRequestValueStatesEnum.COOKIE_STATE, UniversalTag.OCTET_STRING.getValue(),
+                new GrammarAction<SyncRequestValueContainer>( "Set SyncRequestValueControl cookie" )
             {
-                public void action( Asn1Container container ) throws DecoderException
+                public void action( SyncRequestValueContainer container ) throws DecoderException
                 {
-                    SyncRequestValueControlContainer syncRequestValueContainer = ( SyncRequestValueControlContainer ) container;
-                    Value value = syncRequestValueContainer.getCurrentTLV().getValue();
+                    Value value = container.getCurrentTLV().getValue();
 
                     byte[] cookie = value.getData();
 
@@ -170,10 +167,10 @@ public final class SyncRequestValueContr
                         LOG.debug( "cookie = " + Strings.dumpBytes(cookie) );
                     }
 
-                    syncRequestValueContainer.getSyncRequestValueControl().setCookie( cookie );
+                    container.getSyncRequestValueControl().setCookie( cookie );
 
                     // We can have an END transition
-                    syncRequestValueContainer.setGrammarEndAllowed( true );
+                    container.setGrammarEndAllowed( true );
                 }
             } );
 
@@ -187,15 +184,14 @@ public final class SyncRequestValueContr
          *     
          * Stores the reloadHint flag
          */
-        super.transitions[SyncRequestValueControlStatesEnum.MODE_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] = 
-            new GrammarTransition( SyncRequestValueControlStatesEnum.MODE_STATE,
-                                    SyncRequestValueControlStatesEnum.RELOAD_HINT_STATE, UniversalTag.BOOLEAN.getValue(),
-                new GrammarAction( "Set SyncRequestValueControl reloadHint flag" )
+        super.transitions[SyncRequestValueStatesEnum.MODE_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] = 
+            new GrammarTransition( SyncRequestValueStatesEnum.MODE_STATE,
+                                    SyncRequestValueStatesEnum.RELOAD_HINT_STATE, UniversalTag.BOOLEAN.getValue(),
+                new GrammarAction<SyncRequestValueContainer>( "Set SyncRequestValueControl reloadHint flag" )
             {
-                public void action( Asn1Container container ) throws DecoderException
+                public void action( SyncRequestValueContainer container ) throws DecoderException
                 {
-                    SyncRequestValueControlContainer syncRequestValueContainer = ( SyncRequestValueControlContainer ) container;
-                    Value value = syncRequestValueContainer.getCurrentTLV().getValue();
+                    Value value = container.getCurrentTLV().getValue();
 
                     try
                     {
@@ -206,10 +202,10 @@ public final class SyncRequestValueContr
                             LOG.debug( "reloadHint = " + reloadHint );
                         }
 
-                        syncRequestValueContainer.getSyncRequestValueControl().setReloadHint( reloadHint );
+                        container.getSyncRequestValueControl().setReloadHint( reloadHint );
 
                         // We can have an END transition
-                        syncRequestValueContainer.setGrammarEndAllowed( true );
+                        container.setGrammarEndAllowed( true );
                     }
                     catch ( BooleanDecoderException e )
                     {
@@ -230,15 +226,14 @@ public final class SyncRequestValueContr
          *     
          * Stores the reloadHint flag
          */
-        super.transitions[SyncRequestValueControlStatesEnum.COOKIE_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] = 
-            new GrammarTransition( SyncRequestValueControlStatesEnum.COOKIE_STATE,
-                                    SyncRequestValueControlStatesEnum.RELOAD_HINT_STATE, UniversalTag.BOOLEAN.getValue(),
-                new GrammarAction( "Set SyncRequestValueControl reloadHint flag" )
+        super.transitions[SyncRequestValueStatesEnum.COOKIE_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] = 
+            new GrammarTransition( SyncRequestValueStatesEnum.COOKIE_STATE,
+                                    SyncRequestValueStatesEnum.RELOAD_HINT_STATE, UniversalTag.BOOLEAN.getValue(),
+                new GrammarAction<SyncRequestValueContainer>( "Set SyncRequestValueControl reloadHint flag" )
             {
-                public void action( Asn1Container container ) throws DecoderException
+                public void action( SyncRequestValueContainer container ) throws DecoderException
                 {
-                    SyncRequestValueControlContainer syncRequestValueContainer = ( SyncRequestValueControlContainer ) container;
-                    Value value = syncRequestValueContainer.getCurrentTLV().getValue();
+                    Value value = container.getCurrentTLV().getValue();
 
                     try
                     {
@@ -249,10 +244,10 @@ public final class SyncRequestValueContr
                             LOG.debug( "reloadHint = " + reloadHint );
                         }
 
-                        syncRequestValueContainer.getSyncRequestValueControl().setReloadHint( reloadHint );
+                        container.getSyncRequestValueControl().setReloadHint( reloadHint );
 
                         // We can have an END transition
-                        syncRequestValueContainer.setGrammarEndAllowed( true );
+                        container.setGrammarEndAllowed( true );
                     }
                     catch ( BooleanDecoderException e )
                     {

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueStatesEnum.java (from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlStatesEnum.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueStatesEnum.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueStatesEnum.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlStatesEnum.java&r1=1064846&r2=1064981&rev=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlStatesEnum.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueStatesEnum.java Sat Jan 29 08:23:02 2011
@@ -30,7 +30,7 @@ import org.apache.directory.shared.asn1.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public enum SyncRequestValueControlStatesEnum implements States
+public enum SyncRequestValueStatesEnum implements States
 {
     // ~ Static fields/initializers
     // -----------------------------------------------------------------
@@ -79,7 +79,7 @@ public enum SyncRequestValueControlState
      */
     public String getGrammarName( Grammar grammar )
     {
-        if ( grammar instanceof SyncRequestValueControlGrammar )
+        if ( grammar instanceof SyncRequestValueGrammar )
         {
             return "SYNC_REQUEST_VALUE_GRAMMAR";
         }
@@ -112,7 +112,7 @@ public enum SyncRequestValueControlState
     /**
      * {@inheritDoc}
      */
-    public SyncRequestValueControlStatesEnum getStartState()
+    public SyncRequestValueStatesEnum getStartState()
     {
         return START_STATE;
     }

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueContainer.java (from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlContainer.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueContainer.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueContainer.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlContainer.java&r1=1064846&r2=1064981&rev=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlContainer.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueContainer.java Sat Jan 29 08:23:02 2011
@@ -28,29 +28,43 @@ import org.apache.directory.shared.asn1.
  *  
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class SyncStateValueControlContainer extends AbstractContainer
+public class SyncStateValueContainer extends AbstractContainer
 {
     /** SyncStateValueControl */
-    private SyncStateValueControl control;
+    private SyncStateValueDecorator control;
 
 
     /**
      * Creates a new SyncStateValueControlContainer object. We will store one grammar,
      * it's enough ...
      */
-    public SyncStateValueControlContainer()
+    public SyncStateValueContainer()
     {
         super();
         stateStack = new int[1];
-        grammar = SyncStateValueControlGrammar.getInstance();
-        setTransition( SyncStateValueControlStatesEnum.START_STATE );
+        grammar = SyncStateValueGrammar.getInstance();
+        setTransition( SyncStateValueStatesEnum.START_STATE );
+    }
+
+
+    /**
+     * Creates a new SyncStateValueControlContainer object. We will store one grammar,
+     * it's enough ...
+     */
+    public SyncStateValueContainer( SyncStateValueDecorator control )
+    {
+        super();
+        this.control = control;
+        stateStack = new int[1];
+        grammar = SyncStateValueGrammar.getInstance();
+        setTransition( SyncStateValueStatesEnum.START_STATE );
     }
 
 
     /**
      * @return Returns the syncStateValue control.
      */
-    public SyncStateValueControl getSyncStateValueControl()
+    public SyncStateValueDecorator getSyncStateValueControl()
     {
         return control;
     }
@@ -62,7 +76,7 @@ public class SyncStateValueControlContai
      * 
      * @param control the SyncStateValueControl to set.
      */
-    public void setSyncStateValueControl( SyncStateValueControl control )
+    public void setSyncStateValueControl( SyncStateValueDecorator control )
     {
         this.control = control;
     }

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueDecorator.java (from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControl.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueDecorator.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueDecorator.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControl.java&r1=1064846&r2=1064981&rev=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueDecorator.java Sat Jan 29 08:23:02 2011
@@ -23,12 +23,15 @@ 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;
 import org.apache.directory.shared.i18n.I18n;
-import org.apache.directory.shared.ldap.codec.controls.AbstractControl;
+import org.apache.directory.shared.ldap.codec.controls.ControlDecorator;
 import org.apache.directory.shared.ldap.message.control.replication.SyncStateTypeEnum;
 import org.apache.directory.shared.util.Strings;
 
@@ -38,11 +41,8 @@ import org.apache.directory.shared.util.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class SyncStateValueControl  extends AbstractControl
+public class SyncStateValueDecorator extends ControlDecorator<ISyncStateValue> implements ISyncStateValue
 {
-    /** This control OID */
-    public static final String CONTROL_OID = "1.3.6.1.4.1.4203.1.9.1.2";
-
     /** The syncStateEnum type */
     private SyncStateTypeEnum syncStateType;
 
@@ -52,18 +52,30 @@ public class SyncStateValueControl  exte
     /** The entryUUID */
     private byte[] entryUUID;
 
-    /** global length for the control */
+    /** Global length for the control */
     private int syncStateSeqLength;
 
-    public SyncStateValueControl()
+    /** The opaque ASN.1 encoded value for this control */
+    private byte[] value;
+    
+    /** An instance of this decoder */
+    private static final Asn1Decoder decoder = new Asn1Decoder();
+
+    
+    public SyncStateValueDecorator()
     {
-        super( CONTROL_OID );
-        
-        decoder = new SyncStateValueControlDecoder();
+        super( new SyncStateValue() );
     }
 
+    
+    public SyncStateValueDecorator( ISyncStateValue value )
+    {
+        super( value );
+    }
+
+
     /**
-     * @return the cookie
+     * {@inheritDoc}
      */
     public byte[] getCookie()
     {
@@ -72,7 +84,7 @@ public class SyncStateValueControl  exte
 
 
     /**
-     * @param cookie the cookie to set
+     * {@inheritDoc}
      */
     public void setCookie( byte[] cookie )
     {
@@ -81,7 +93,7 @@ public class SyncStateValueControl  exte
 
 
     /**
-     * @return the syncState's type
+     * {@inheritDoc}
      */
     public SyncStateTypeEnum getSyncStateType()
     {
@@ -90,9 +102,7 @@ public class SyncStateValueControl  exte
 
 
     /**
-     * set the syncState's type
-     * 
-     * @param syncStateType the syncState's type
+     * {@inheritDoc}
      */
     public void setSyncStateType( SyncStateTypeEnum syncStateType )
     {
@@ -101,7 +111,7 @@ public class SyncStateValueControl  exte
 
 
     /**
-     * @return the entryUUID
+     * {@inheritDoc}
      */
     public byte[] getEntryUUID()
     {
@@ -110,9 +120,7 @@ public class SyncStateValueControl  exte
 
 
     /**
-     * set the entryUUID
-     * 
-     * @param entryUUID the entryUUID
+     * {@inheritDoc}
      */
     public void setEntryUUID( byte[] entryUUID )
     {
@@ -245,7 +253,7 @@ public class SyncStateValueControl  exte
             return false;
         }
 
-        SyncStateValueControl otherControl = ( SyncStateValueControl ) o;
+        SyncStateValueDecorator otherControl = ( SyncStateValueDecorator ) o;
         
         return ( syncStateType == otherControl.syncStateType ) && 
             ( Arrays.equals( entryUUID, otherControl.entryUUID ) ) &&
@@ -269,4 +277,13 @@ public class SyncStateValueControl  exte
 
         return sb.toString();
     }
+
+    @Override
+    public Asn1Object decode( byte[] controlBytes ) throws DecoderException
+    {
+        ByteBuffer bb = ByteBuffer.wrap( controlBytes );
+        SyncStateValueContainer container = new SyncStateValueContainer( this );
+        decoder.decode( bb, container );
+        return this;
+    }
 }

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueGrammar.java (from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlGrammar.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueGrammar.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueGrammar.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlGrammar.java&r1=1064846&r2=1064981&rev=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlGrammar.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueGrammar.java Sat Jan 29 08:23:02 2011
@@ -20,7 +20,6 @@
 package org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue;
 
 
-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;
@@ -56,27 +55,27 @@ import org.slf4j.LoggerFactory;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public final class SyncStateValueControlGrammar extends AbstractGrammar
+public final class SyncStateValueGrammar extends AbstractGrammar
 {
     /** The logger */
-    static final Logger LOG = LoggerFactory.getLogger( SyncStateValueControlGrammar.class );
+    static final Logger LOG = LoggerFactory.getLogger( SyncStateValueGrammar.class );
 
     /** Speedup for logs */
     static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     /** The instance of grammar. SyncStateValueControlGrammar is a singleton */
-    private static Grammar instance = new SyncStateValueControlGrammar();
+    private static Grammar instance = new SyncStateValueGrammar();
 
 
     /**
      * Creates a new SyncStateValueControlGrammar object.
      */
-    private SyncStateValueControlGrammar()
+    private SyncStateValueGrammar()
     {
-        setName( SyncStateValueControlGrammar.class.getName() );
+        setName( SyncStateValueGrammar.class.getName() );
 
         // Create the transitions table
-        super.transitions = new GrammarTransition[SyncStateValueControlStatesEnum.LAST_SYNC_STATE_VALUE_STATE.ordinal()][256];
+        super.transitions = new GrammarTransition[SyncStateValueStatesEnum.LAST_SYNC_STATE_VALUE_STATE.ordinal()][256];
 
         /** 
          * Transition from initial state to SyncStateValue sequence
@@ -85,8 +84,8 @@ public final class SyncStateValueControl
          *     
          * Initialize the syncStateValue object
          */
-        super.transitions[SyncStateValueControlStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            SyncStateValueControlStatesEnum.START_STATE, SyncStateValueControlStatesEnum.SYNC_STATE_VALUE_SEQUENCE_STATE,
+        super.transitions[SyncStateValueStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
+            SyncStateValueStatesEnum.START_STATE, SyncStateValueStatesEnum.SYNC_STATE_VALUE_SEQUENCE_STATE,
             UniversalTag.SEQUENCE.getValue(), null );
 
         /** 
@@ -102,15 +101,14 @@ public final class SyncStateValueControl
          *     
          * Stores the sync state type value
          */
-        super.transitions[SyncStateValueControlStatesEnum.SYNC_STATE_VALUE_SEQUENCE_STATE.ordinal()][UniversalTag.ENUMERATED.getValue()] = new GrammarTransition(
-            SyncStateValueControlStatesEnum.SYNC_STATE_VALUE_SEQUENCE_STATE,
-            SyncStateValueControlStatesEnum.SYNC_TYPE_STATE, UniversalTag.ENUMERATED.getValue(), new GrammarAction(
-                "Set SyncStateValueControl state type" )
+        super.transitions[SyncStateValueStatesEnum.SYNC_STATE_VALUE_SEQUENCE_STATE.ordinal()][UniversalTag.ENUMERATED.getValue()] = new GrammarTransition(
+            SyncStateValueStatesEnum.SYNC_STATE_VALUE_SEQUENCE_STATE,
+            SyncStateValueStatesEnum.SYNC_TYPE_STATE, UniversalTag.ENUMERATED.getValue(), 
+            new GrammarAction<SyncStateValueContainer>( "Set SyncStateValueControl state type" )
             {
-                public void action( Asn1Container container ) throws DecoderException
+                public void action( SyncStateValueContainer container ) throws DecoderException
                 {
-                    SyncStateValueControlContainer syncStateValueContainer = ( SyncStateValueControlContainer ) container;
-                    Value value = syncStateValueContainer.getCurrentTLV().getValue();
+                    Value value = container.getCurrentTLV().getValue();
 
                     try
                     {
@@ -125,10 +123,10 @@ public final class SyncStateValueControl
                             LOG.debug( "SyncStateType = {}", syncStateTypeEnum );
                         }
 
-                        syncStateValueContainer.getSyncStateValueControl().setSyncStateType( syncStateTypeEnum );
+                        container.getSyncStateValueControl().setSyncStateType( syncStateTypeEnum );
 
-                        // move on to the entryUUID transistion
-                        syncStateValueContainer.setGrammarEndAllowed( false );
+                        // move on to the entryUUID transition
+                        container.setGrammarEndAllowed( false );
                     }
                     catch ( IntegerDecoderException e )
                     {
@@ -148,14 +146,14 @@ public final class SyncStateValueControl
          *     
          * Stores the entryUUID
          */
-        super.transitions[SyncStateValueControlStatesEnum.SYNC_TYPE_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
-            SyncStateValueControlStatesEnum.SYNC_TYPE_STATE, SyncStateValueControlStatesEnum.SYNC_UUID_STATE,
-            UniversalTag.OCTET_STRING.getValue(), new GrammarAction( "Set SyncStateValueControl entryUUID" )
+        super.transitions[SyncStateValueStatesEnum.SYNC_TYPE_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
+            SyncStateValueStatesEnum.SYNC_TYPE_STATE, SyncStateValueStatesEnum.SYNC_UUID_STATE,
+            UniversalTag.OCTET_STRING.getValue(), 
+            new GrammarAction<SyncStateValueContainer>( "Set SyncStateValueControl entryUUID" )
             {
-                public void action( Asn1Container container ) throws DecoderException
+                public void action( SyncStateValueContainer container ) throws DecoderException
                 {
-                    SyncStateValueControlContainer syncStateValueContainer = ( SyncStateValueControlContainer ) container;
-                    Value value = syncStateValueContainer.getCurrentTLV().getValue();
+                    Value value = container.getCurrentTLV().getValue();
 
                     byte[] entryUUID = value.getData();
 
@@ -164,10 +162,10 @@ public final class SyncStateValueControl
                         LOG.debug( "entryUUID = {}", Strings.dumpBytes(entryUUID) );
                     }
 
-                    syncStateValueContainer.getSyncStateValueControl().setEntryUUID( entryUUID );
+                    container.getSyncStateValueControl().setEntryUUID( entryUUID );
 
                     // We can have an END transition
-                    syncStateValueContainer.setGrammarEndAllowed( true );
+                    container.setGrammarEndAllowed( true );
                 }
             } );
 
@@ -180,14 +178,14 @@ public final class SyncStateValueControl
          *     
          * Stores the reloadHint flag
          */
-        super.transitions[SyncStateValueControlStatesEnum.SYNC_UUID_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
-            SyncStateValueControlStatesEnum.SYNC_UUID_STATE, SyncStateValueControlStatesEnum.COOKIE_STATE,
-            UniversalTag.OCTET_STRING.getValue(), new GrammarAction( "Set SyncStateValueControl cookie value" )
+        super.transitions[SyncStateValueStatesEnum.SYNC_UUID_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
+            SyncStateValueStatesEnum.SYNC_UUID_STATE, SyncStateValueStatesEnum.COOKIE_STATE,
+            UniversalTag.OCTET_STRING.getValue(), 
+            new GrammarAction<SyncStateValueContainer>( "Set SyncStateValueControl cookie value" )
             {
-                public void action( Asn1Container container ) throws DecoderException
+                public void action( SyncStateValueContainer container ) throws DecoderException
                 {
-                    SyncStateValueControlContainer syncStateValueContainer = ( SyncStateValueControlContainer ) container;
-                    Value value = syncStateValueContainer.getCurrentTLV().getValue();
+                    Value value = container.getCurrentTLV().getValue();
 
                     byte[] cookie = value.getData();
 
@@ -196,10 +194,10 @@ public final class SyncStateValueControl
                         LOG.debug( "cookie = {}", cookie );
                     }
 
-                    syncStateValueContainer.getSyncStateValueControl().setCookie( cookie );
+                    container.getSyncStateValueControl().setCookie( cookie );
 
                     // terminal state
-                    syncStateValueContainer.setGrammarEndAllowed( true );
+                    container.setGrammarEndAllowed( true );
                 }
             } );
     }

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueStatesEnum.java (from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlStatesEnum.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueStatesEnum.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueStatesEnum.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlStatesEnum.java&r1=1064846&r2=1064981&rev=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlStatesEnum.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueStatesEnum.java Sat Jan 29 08:23:02 2011
@@ -30,7 +30,7 @@ import org.apache.directory.shared.asn1.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public enum SyncStateValueControlStatesEnum implements States
+public enum SyncStateValueStatesEnum implements States
 {
     // ~ Static fields/initializers
     // -----------------------------------------------------------------
@@ -79,7 +79,7 @@ public enum SyncStateValueControlStatesE
      */
     public String getGrammarName( Grammar grammar )
     {
-        if ( grammar instanceof SyncStateValueControlGrammar )
+        if ( grammar instanceof SyncStateValueGrammar )
         {
             return "SYNC_STATE_VALUE_GRAMMAR";
         }
@@ -112,7 +112,7 @@ public enum SyncStateValueControlStatesE
     /**
      * {@inheritDoc}
      */
-    public SyncStateValueControlStatesEnum getStartState()
+    public SyncStateValueStatesEnum getStartState()
     {
         return START_STATE;
     }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AbandonRequestDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AbandonRequestDecorator.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AbandonRequestDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AbandonRequestDecorator.java Sat Jan 29 08:23:02 2011
@@ -26,6 +26,7 @@ import java.nio.ByteBuffer;
 import org.apache.directory.shared.asn1.EncoderException;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
 import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.codec.ILdapCodecService;
 import org.apache.directory.shared.ldap.codec.LdapConstants;
 import org.apache.directory.shared.ldap.model.message.AbandonRequest;
 
@@ -35,37 +36,31 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class AbandonRequestDecorator extends RequestDecorator implements AbandonRequest
+public final class AbandonRequestDecorator extends RequestDecorator<AbandonRequest>
+    implements AbandonRequest
 {
     /**
      * Makes a AddRequest a MessageDecorator.
      *
      * @param decoratedMessage the decorated AddRequest
      */
-    public AbandonRequestDecorator( AbandonRequest decoratedMessage )
+    public AbandonRequestDecorator( ILdapCodecService codec, AbandonRequest decoratedMessage )
     {
-        super( decoratedMessage );
-    }
-
-
-    /**
-     * @return The decorated AddRequest
-     */
-    public AbandonRequest getAbandonRequest()
-    {
-        return ( AbandonRequest ) getDecoratedMessage();
+        super( codec, decoratedMessage );
     }
 
 
     //-------------------------------------------------------------------------
     // The AbandonRequest methods
     //-------------------------------------------------------------------------
+    
+    
     /**
      * {@inheritDoc}
      */
     public int getAbandoned()
     {
-        return getAbandonRequest().getAbandoned();
+        return getDecorated().getAbandoned();
     }
 
 
@@ -74,13 +69,15 @@ public class AbandonRequestDecorator ext
      */
     public void setAbandoned( int requestId )
     {
-        getAbandonRequest().setAbandoned( requestId );
+        getDecorated().setAbandoned( requestId );
     }
 
     
     //-------------------------------------------------------------------------
     // The Decorator methods
     //-------------------------------------------------------------------------
+    
+    
     /**
      * Encode the Abandon protocolOp part
      */

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AbandonableRequestDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AbandonableRequestDecorator.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AbandonableRequestDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AbandonableRequestDecorator.java Sat Jan 29 08:23:02 2011
@@ -20,9 +20,9 @@
 package org.apache.directory.shared.ldap.codec.decorators;
 
 
+import org.apache.directory.shared.ldap.codec.ILdapCodecService;
 import org.apache.directory.shared.ldap.model.message.AbandonListener;
 import org.apache.directory.shared.ldap.model.message.AbandonableRequest;
-import org.apache.directory.shared.ldap.model.message.Message;
 
 
 /**
@@ -30,16 +30,18 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public abstract class AbandonableRequestDecorator extends RequestDecorator implements AbandonableRequest
+public abstract class AbandonableRequestDecorator<M extends AbandonableResultResponseRequest> 
+    extends ResultResponseRequestDecorator<M> 
+    implements AbandonableRequest
 {
     /**
      * Makes Request a MessageDecorator.
      *
      * @param decoratedMessage the decorated message
      */
-    public AbandonableRequestDecorator( Message decoratedMessage )
+    public AbandonableRequestDecorator( ILdapCodecService codec, M decoratedMessage )
     {
-        super( decoratedMessage );
+        super( codec, decoratedMessage );
     }
 
     
@@ -50,7 +52,7 @@ public abstract class AbandonableRequest
      */
     public AbandonableRequest getAbandonableRequest()
     {
-        return ( AbandonableRequest ) getDecoratedMessage();
+        return getDecorated();
     }
     
     

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AbandonableResultResponseRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AbandonableResultResponseRequest.java?rev=1064981&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AbandonableResultResponseRequest.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AbandonableResultResponseRequest.java Sat Jan 29 08:23:02 2011
@@ -0,0 +1,33 @@
+/*
+ * 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.decorators;
+
+
+import org.apache.directory.shared.ldap.model.message.AbandonableRequest;
+import org.apache.directory.shared.ldap.model.message.ResultResponseRequest;
+
+
+/**
+ * A composite interface needed for {@link AbandonableRequest} {@link ResultResponseRequest}s.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public interface AbandonableResultResponseRequest extends ResultResponseRequest, AbandonableRequest
+{
+}

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AbandonableResultResponseRequestDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AbandonableResultResponseRequestDecorator.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AbandonableResultResponseRequestDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AbandonableResultResponseRequestDecorator.java Sat Jan 29 08:23:02 2011
@@ -20,8 +20,7 @@
 package org.apache.directory.shared.ldap.codec.decorators;
 
 
-import org.apache.directory.shared.ldap.model.message.Message;
-import org.apache.directory.shared.ldap.model.message.Request;
+import org.apache.directory.shared.ldap.codec.ILdapCodecService;
 import org.apache.directory.shared.ldap.model.message.ResultResponse;
 import org.apache.directory.shared.ldap.model.message.ResultResponseRequest;
 
@@ -31,16 +30,17 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public abstract class AbandonableResultResponseRequestDecorator extends AbandonableRequestDecorator implements ResultResponseRequest
+public abstract class AbandonableResultResponseRequestDecorator<M extends AbandonableResultResponseRequest> 
+    extends AbandonableRequestDecorator<M> implements ResultResponseRequest
 {
     /**
      * Makes Request a MessageDecorator.
      *
      * @param decoratedMessage the decorated message
      */
-    public AbandonableResultResponseRequestDecorator( Message decoratedMessage )
+    public AbandonableResultResponseRequestDecorator( ILdapCodecService codec, M decoratedMessage )
     {
-        super( decoratedMessage );
+        super( codec, decoratedMessage );
     }
     
 
@@ -49,7 +49,7 @@ public abstract class AbandonableResultR
      */
     public boolean hasResponse()
     {
-        return ( ( Request ) getDecoratedMessage() ).hasResponse();
+        return getDecorated().hasResponse();
     }
 
 
@@ -58,6 +58,6 @@ public abstract class AbandonableResultR
      */
     public ResultResponse getResultResponse()
     {
-        return ( ( ResultResponseRequest ) getDecoratedMessage() ).getResultResponse();
+        return getDecorated().getResultResponse();
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AddRequestDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AddRequestDecorator.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AddRequestDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AddRequestDecorator.java Sat Jan 29 08:23:02 2011
@@ -29,6 +29,7 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
 import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.codec.ILdapCodecService;
 import org.apache.directory.shared.ldap.codec.LdapConstants;
 import org.apache.directory.shared.ldap.model.entry.DefaultEntryAttribute;
 import org.apache.directory.shared.ldap.model.entry.Entry;
@@ -44,7 +45,7 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class AddRequestDecorator extends SingleReplyRequestDecorator implements AddRequest
+public final class AddRequestDecorator extends SingleReplyRequestDecorator<AddRequest> implements AddRequest
 {
     /** The add request length */
     private int addRequestLength;
@@ -67,18 +68,9 @@ public class AddRequestDecorator extends
      *
      * @param decoratedMessage the decorated AddRequest
      */
-    public AddRequestDecorator( AddRequest decoratedMessage )
+    public AddRequestDecorator( ILdapCodecService codec, AddRequest decoratedMessage )
     {
-        super( decoratedMessage );
-    }
-
-
-    /**
-     * @return The decorated AddRequest
-     */
-    public AddRequest getAddRequest()
-    {
-        return ( AddRequest ) getDecoratedMessage();
+        super( codec, decoratedMessage );
     }
 
 
@@ -168,7 +160,7 @@ public class AddRequestDecorator extends
      */
     public Dn getEntryDn()
     {
-        return getAddRequest().getEntryDn();
+        return getDecorated().getEntryDn();
     }
 
 
@@ -177,7 +169,7 @@ public class AddRequestDecorator extends
      */
     public void setEntryDn( Dn entry )
     {
-        getAddRequest().setEntryDn( entry );
+        getDecorated().setEntryDn( entry );
     }
 
 
@@ -186,7 +178,7 @@ public class AddRequestDecorator extends
      */
     public Entry getEntry()
     {
-        return getAddRequest().getEntry();
+        return getDecorated().getEntry();
     }
 
 
@@ -195,7 +187,7 @@ public class AddRequestDecorator extends
      */
     public void setEntry( Entry entry )
     {
-        getAddRequest().setEntry( entry );
+        getDecorated().setEntry( entry );
     }
 
     
@@ -207,15 +199,15 @@ public class AddRequestDecorator extends
     public void addAttributeType( String type ) throws LdapException
     {
         // do not create a new attribute if we have seen this attributeType before
-        if ( getAddRequest().getEntry().get( type ) != null )
+        if ( getDecorated().getEntry().get( type ) != null )
         {
-            currentAttribute = getAddRequest().getEntry().get( type );
+            currentAttribute = getDecorated().getEntry().get( type );
             return;
         }
 
         // fix this to use AttributeImpl(type.getString().toLowerCase())
         currentAttribute = new DefaultEntryAttribute( type );
-        getAddRequest().getEntry().put( currentAttribute );
+        getDecorated().getEntry().put( currentAttribute );
     }
 
 
@@ -305,7 +297,7 @@ public class AddRequestDecorator extends
      */
     public int computeLength()
     {
-        AddRequest addRequest = getAddRequest();
+        AddRequest addRequest = getDecorated();
         Entry entry = addRequest.getEntry();
 
         if ( entry == null )

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AddResponseDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AddResponseDecorator.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AddResponseDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AddResponseDecorator.java Sat Jan 29 08:23:02 2011
@@ -26,6 +26,7 @@ import java.nio.ByteBuffer;
 import org.apache.directory.shared.asn1.EncoderException;
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.codec.ILdapCodecService;
 import org.apache.directory.shared.ldap.codec.LdapConstants;
 import org.apache.directory.shared.ldap.model.message.AddResponse;
 
@@ -35,7 +36,7 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class AddResponseDecorator extends ResponseDecorator implements AddResponse
+public class AddResponseDecorator extends ResponseDecorator<AddResponse> implements AddResponse
 {
     /** The encoded addResponse length */
     private int addResponseLength;
@@ -46,9 +47,9 @@ public class AddResponseDecorator extend
      *
      * @param decoratedMessage the decorated AddResponse
      */
-    public AddResponseDecorator( AddResponse decoratedMessage)
+    public AddResponseDecorator( ILdapCodecService codec, AddResponse decoratedMessage )
     {
-        super( decoratedMessage );
+        super( codec, decoratedMessage );
     }
 
 
@@ -57,7 +58,7 @@ public class AddResponseDecorator extend
      */
     public AddResponse getAddResponse()
     {
-        return ( AddResponse ) getDecoratedMessage();
+        return ( AddResponse ) getDecorated();
     }
 
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/BindRequestDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/BindRequestDecorator.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/BindRequestDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/BindRequestDecorator.java Sat Jan 29 08:23:02 2011
@@ -27,6 +27,7 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
 import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.codec.ILdapCodecService;
 import org.apache.directory.shared.ldap.codec.LdapConstants;
 import org.apache.directory.shared.ldap.model.message.BindRequest;
 import org.apache.directory.shared.ldap.model.name.Dn;
@@ -38,7 +39,8 @@ import org.apache.directory.shared.util.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class BindRequestDecorator extends SingleReplyRequestDecorator implements BindRequest
+public class BindRequestDecorator extends SingleReplyRequestDecorator<BindRequest> 
+    implements BindRequest
 {
     /** The bind request length */
     private int bindRequestLength;
@@ -55,18 +57,9 @@ public class BindRequestDecorator extend
      *
      * @param decoratedMessage the decorated BindRequests.
      */
-    public BindRequestDecorator( BindRequest decoratedMessage )
+    public BindRequestDecorator( ILdapCodecService codec, BindRequest decoratedMessage )
     {
-        super( decoratedMessage );
-    }
-
-
-    /**
-     * @return The decorated BindRequest
-     */
-    public BindRequest getBindRequest()
-    {
-        return ( BindRequest ) getDecoratedMessage();
+        super( codec, decoratedMessage );
     }
 
 
@@ -137,7 +130,7 @@ public class BindRequestDecorator extend
      */
     public boolean isSimple()
     {
-        return getBindRequest().isSimple();
+        return getDecorated().isSimple();
     }
 
 
@@ -146,7 +139,7 @@ public class BindRequestDecorator extend
      */
     public boolean getSimple()
     {
-        return getBindRequest().getSimple();
+        return getDecorated().getSimple();
     }
 
 
@@ -155,7 +148,7 @@ public class BindRequestDecorator extend
      */
     public void setSimple( boolean isSimple )
     {
-        getBindRequest().setSimple( isSimple );
+        getDecorated().setSimple( isSimple );
     }
 
 
@@ -164,7 +157,7 @@ public class BindRequestDecorator extend
      */
     public byte[] getCredentials()
     {
-        return getBindRequest().getCredentials();
+        return getDecorated().getCredentials();
     }
 
 
@@ -173,7 +166,7 @@ public class BindRequestDecorator extend
      */
     public void setCredentials( String credentials )
     {
-        getBindRequest().setCredentials( credentials );
+        getDecorated().setCredentials( credentials );
     }
 
 
@@ -182,7 +175,7 @@ public class BindRequestDecorator extend
      */
     public void setCredentials( byte[] credentials )
     {
-        getBindRequest().setCredentials( credentials );
+        getDecorated().setCredentials( credentials );
     }
 
 
@@ -191,7 +184,7 @@ public class BindRequestDecorator extend
      */
     public Dn getName()
     {
-        return getBindRequest().getName();
+        return getDecorated().getName();
     }
 
 
@@ -200,7 +193,7 @@ public class BindRequestDecorator extend
      */
     public void setName( Dn name )
     {
-        getBindRequest().setName( name );
+        getDecorated().setName( name );
     }
 
 
@@ -209,7 +202,7 @@ public class BindRequestDecorator extend
      */
     public boolean isVersion3()
     {
-        return getBindRequest().isVersion3();
+        return getDecorated().isVersion3();
     }
 
 
@@ -218,7 +211,7 @@ public class BindRequestDecorator extend
      */
     public boolean getVersion3()
     {
-        return getBindRequest().getVersion3();
+        return getDecorated().getVersion3();
     }
 
 
@@ -227,7 +220,7 @@ public class BindRequestDecorator extend
      */
     public void setVersion3( boolean isVersion3 )
     {
-        getBindRequest().setVersion3( isVersion3 );
+        getDecorated().setVersion3( isVersion3 );
     }
 
 
@@ -236,7 +229,7 @@ public class BindRequestDecorator extend
      */
     public String getSaslMechanism()
     {
-        return getBindRequest().getSaslMechanism();
+        return getDecorated().getSaslMechanism();
     }
 
 
@@ -245,7 +238,7 @@ public class BindRequestDecorator extend
      */
     public void setSaslMechanism( String saslMechanism )
     {
-        getBindRequest().setSaslMechanism( saslMechanism );
+        getDecorated().setSaslMechanism( saslMechanism );
     }
 
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/BindResponseDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/BindResponseDecorator.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/BindResponseDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/BindResponseDecorator.java Sat Jan 29 08:23:02 2011
@@ -26,6 +26,7 @@ import java.nio.ByteBuffer;
 import org.apache.directory.shared.asn1.EncoderException;
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.codec.ILdapCodecService;
 import org.apache.directory.shared.ldap.codec.LdapConstants;
 import org.apache.directory.shared.ldap.model.message.BindResponse;
 
@@ -35,7 +36,7 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class BindResponseDecorator extends ResponseDecorator implements BindResponse
+public class BindResponseDecorator extends ResponseDecorator<BindResponse> implements BindResponse
 {
     /** The encoded bindResponse length */
     private int bindResponseLength;
@@ -46,18 +47,9 @@ public class BindResponseDecorator exten
      *
      * @param decoratedMessage the decorated BindResponse
      */
-    public BindResponseDecorator( BindResponse decoratedMessage )
+    public BindResponseDecorator( ILdapCodecService codec, BindResponse decoratedMessage )
     {
-        super( decoratedMessage );
-    }
-
-
-    /**
-     * @return The decorated BindResponse
-     */
-    public BindResponse getBindResponse()
-    {
-        return ( BindResponse ) getDecoratedMessage();
+        super( codec, decoratedMessage );
     }
 
 
@@ -90,7 +82,7 @@ public class BindResponseDecorator exten
      */
     public byte[] getServerSaslCreds()
     {
-        return getBindResponse().getServerSaslCreds();
+        return getDecorated().getServerSaslCreds();
     }
 
 
@@ -99,7 +91,7 @@ public class BindResponseDecorator exten
      */
     public void setServerSaslCreds( byte[] serverSaslCreds )
     {
-        getBindResponse().setServerSaslCreds( serverSaslCreds );
+        getDecorated().setServerSaslCreds( serverSaslCreds );
     }
     
     
@@ -122,7 +114,7 @@ public class BindResponseDecorator exten
      */
     public int computeLength()
     {
-        BindResponse bindResponse = getBindResponse();
+        BindResponse bindResponse = getDecorated();
         int ldapResultLength = ((LdapResultDecorator)getLdapResult()).computeLength();
 
         int bindResponseLength = ldapResultLength;
@@ -155,7 +147,7 @@ public class BindResponseDecorator exten
      */
     public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
     {
-        BindResponse bindResponse = getBindResponse();
+        BindResponse bindResponse = getDecorated();
 
         try
         {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/CompareRequestDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/CompareRequestDecorator.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/CompareRequestDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/CompareRequestDecorator.java Sat Jan 29 08:23:02 2011
@@ -27,6 +27,7 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
 import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.codec.ILdapCodecService;
 import org.apache.directory.shared.ldap.codec.LdapConstants;
 import org.apache.directory.shared.ldap.model.entry.BinaryValue;
 import org.apache.directory.shared.ldap.model.entry.Value;
@@ -40,7 +41,8 @@ import org.apache.directory.shared.util.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class CompareRequestDecorator extends SingleReplyRequestDecorator implements CompareRequest
+public class CompareRequestDecorator extends SingleReplyRequestDecorator<CompareRequest> 
+    implements CompareRequest
 {
     /** The bytes of the attribute id used in the comparison */
     private byte[] attrIdBytes;
@@ -60,18 +62,9 @@ public class CompareRequestDecorator ext
      *
      * @param decoratedMessage the decorated CompareRequest
      */
-    public CompareRequestDecorator( CompareRequest decoratedMessage )
+    public CompareRequestDecorator( ILdapCodecService codec, CompareRequest decoratedMessage )
     {
-        super( decoratedMessage );
-    }
-
-
-    /**
-     * @return The decorated CompareRequest
-     */
-    public CompareRequest getCompareRequest()
-    {
-        return ( CompareRequest ) getDecoratedMessage();
+        super( codec, decoratedMessage );
     }
 
 
@@ -167,7 +160,7 @@ public class CompareRequestDecorator ext
      */
     public Dn getName()
     {
-        return getCompareRequest().getName();
+        return getDecorated().getName();
     }
 
 
@@ -176,7 +169,7 @@ public class CompareRequestDecorator ext
      */
     public void setName( Dn name )
     {
-        getCompareRequest().setName( name );
+        getDecorated().setName( name );
     }
 
 
@@ -185,7 +178,7 @@ public class CompareRequestDecorator ext
      */
     public Value<?> getAssertionValue()
     {
-        return getCompareRequest().getAssertionValue();
+        return getDecorated().getAssertionValue();
     }
 
 
@@ -194,7 +187,7 @@ public class CompareRequestDecorator ext
      */
     public void setAssertionValue( String value )
     {
-        getCompareRequest().setAssertionValue( value );
+        getDecorated().setAssertionValue( value );
     }
 
 
@@ -203,7 +196,7 @@ public class CompareRequestDecorator ext
      */
     public void setAssertionValue( byte[] value )
     {
-        getCompareRequest().setAssertionValue( value );
+        getDecorated().setAssertionValue( value );
     }
 
 
@@ -212,7 +205,7 @@ public class CompareRequestDecorator ext
      */
     public String getAttributeId()
     {
-        return getCompareRequest().getAttributeId();
+        return getDecorated().getAttributeId();
     }
 
 
@@ -221,7 +214,7 @@ public class CompareRequestDecorator ext
      */
     public void setAttributeId( String attrId )
     {
-        getCompareRequest().setAttributeId( attrId );
+        getDecorated().setAttributeId( attrId );
     }
 
     



Mime
View raw message