directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r569235 - in /directory/shared/trunk/ldap/src: main/java/org/apache/directory/shared/ldap/codec/ main/java/org/apache/directory/shared/ldap/message/ test/java/org/apache/directory/shared/ldap/message/
Date Fri, 24 Aug 2007 03:40:48 GMT
Author: akarasulu
Date: Thu Aug 23 20:40:46 2007
New Revision: 569235

URL: http://svn.apache.org/viewvc?rev=569235&view=rev
Log:
changes for DIRSERVER-1030:

 o Renamed Control to MutableControl for correctness and prevent collisions
 o Modified Message hierarchy to avoid using useless pseudonyms for getID etc


Added:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractMutableControlImpl.java
      - copied, changed from r569146, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ControlImpl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/MutableControl.java
      - copied, changed from r569146, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/Control.java
Removed:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/Control.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ControlImpl.java
Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractMessage.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CascadeControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/EntryChangeControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ManageDsaITControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/Message.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/PersistentSearchControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SubentriesControl.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/AbstractMessageTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/AbstractResultResponseTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/AddRequestImplTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/BindRequestImplTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/CompareRequestImplTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/DeleteRequestImplTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ExtendedRequestImplTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ExtendedResponseImplTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModifyDnRequestImplTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModifyRequestImplTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseDoneImplTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseEntryImplTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseReferenceImplTest.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java?rev=569235&r1=569234&r2=569235&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
Thu Aug 23 20:40:46 2007
@@ -82,7 +82,7 @@
 import org.apache.directory.shared.ldap.message.CascadeControl;
 import org.apache.directory.shared.ldap.message.CompareRequestImpl;
 import org.apache.directory.shared.ldap.message.CompareResponseImpl;
-import org.apache.directory.shared.ldap.message.ControlImpl;
+import org.apache.directory.shared.ldap.message.AbstractMutableControlImpl;
 import org.apache.directory.shared.ldap.message.DeleteRequestImpl;
 import org.apache.directory.shared.ldap.message.DeleteResponseImpl;
 import org.apache.directory.shared.ldap.message.DerefAliasesEnum;
@@ -758,16 +758,15 @@
 
             while ( controls.hasNext() )
             {
-                ControlImpl neutralControl = null;
-                org.apache.directory.shared.ldap.codec.Control twixControl = ( org.apache.directory.shared.ldap.codec.Control
) controls
-                    .next();
+                AbstractMutableControlImpl neutralControl = null;
+                final org.apache.directory.shared.ldap.codec.Control twixControl = 
+                    ( org.apache.directory.shared.ldap.codec.Control ) controls.next();
 
                 if ( twixControl.getControlValue() instanceof 
                     org.apache.directory.shared.ldap.codec.controls.CascadeControl )
                 {
                     neutralControl = new CascadeControl();
                     neutralControl.setCritical( twixControl.getCriticality() );
-                    neutralControl.setValue( twixControl.getEncodedValue() );
                 }
                 else if ( twixControl.getControlValue() instanceof PSearchControl )
                 {
@@ -778,7 +777,6 @@
                     neutralPsearch.setChangesOnly( twixPsearch.isChangesOnly() );
                     neutralPsearch.setReturnECs( twixPsearch.isReturnECs() );
                     neutralPsearch.setCritical( twixControl.getCriticality() );
-                    neutralPsearch.setValue( twixControl.getEncodedValue() );
                 }
                 else if ( twixControl.getControlValue() instanceof SubEntryControl )
                 {
@@ -787,11 +785,10 @@
                     neutralControl = neutralSubentriesControl;
                     neutralSubentriesControl.setVisibility( twixSubentriesControl.isVisible()
);
                     neutralSubentriesControl.setCritical( twixControl.getCriticality() );
-                    neutralSubentriesControl.setValue( twixControl.getEncodedValue() );
                 }
                 else if ( twixControl.getControlValue() instanceof byte[] )
                 {
-                    neutralControl = new ControlImpl()
+                    neutralControl = new AbstractMutableControlImpl()
                     {
                         // Just to avoid a compilation warning !!!
                         public static final long serialVersionUID = 1L;
@@ -799,7 +796,7 @@
 
                         public byte[] getEncodedValue()
                         {
-                            return null;
+                            return ( byte[] ) twixControl.getControlValue();
                         }
                     };
 
@@ -808,15 +805,11 @@
                     neutralControl.setCritical( twixControl.getCriticality() );
 
                     // Twix : OID controlType -> Snickers : String m_oid
-                    neutralControl.setType( twixControl.getControlType() );
-
-                    // Twix : OctetString controlValue -> Snickers : byte []
-                    // m_value
-                    neutralControl.setValue( ( byte[] ) twixControl.getControlValue() );
+                    neutralControl.setID( twixControl.getControlType() );
                 }
                 else if ( twixControl.getControlValue() == null )
                 {
-                    neutralControl = new ControlImpl()
+                    neutralControl = new AbstractMutableControlImpl()
                     {
                         // Just to avoid a compilation warning !!!
                         public static final long serialVersionUID = 1L;
@@ -824,7 +817,7 @@
 
                         public byte[] getEncodedValue()
                         {
-                            return null;
+                            return ( byte[] ) twixControl.getControlValue();
                         }
                     };
 
@@ -833,11 +826,7 @@
                     neutralControl.setCritical( twixControl.getCriticality() );
 
                     // Twix : OID controlType -> Snickers : String m_oid
-                    neutralControl.setType( twixControl.getControlType() );
-
-                    // Twix : OctetString controlValue -> Snickers : byte []
-                    // m_value
-                    neutralControl.setValue( ( byte[] ) twixControl.getControlValue() );
+                    neutralControl.setID( twixControl.getControlType() );
                 }
                 
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractMessage.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractMessage.java?rev=569235&r1=569234&r2=569235&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractMessage.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractMessage.java
Thu Aug 23 20:40:46 2007
@@ -24,6 +24,8 @@
 import java.util.Iterator;
 import java.util.Map;
 
+import javax.naming.ldap.Control;
+
 
 
 /**
@@ -32,7 +34,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class AbstractMessage implements Message
+public abstract class AbstractMessage implements Message
 {
     static final long serialVersionUID = 7601738291101182094L;
 
@@ -57,7 +59,7 @@
      * @param type
      *            the type of the message
      */
-    protected AbstractMessage(final int id, final MessageTypeEnum type)
+    protected AbstractMessage( final int id, final MessageTypeEnum type )
     {
         this.id = id;
         this.type = type;
@@ -84,7 +86,7 @@
      * Gets the controls associated with this message mapped by OID.
      * 
      * @return Map of OID strings to Control object instances.
-     * @see Control
+     * @see MutableControl
      */
     public Map<String, Control> getControls()
     {
@@ -103,7 +105,7 @@
      */
     public void add( Control control ) throws MessageException
     {
-        controls.put( control.getType(), control );
+        controls.put( control.getID(), control );
     }
 
 
@@ -118,7 +120,7 @@
      */
     public void remove( Control control ) throws MessageException
     {
-        controls.remove( control.getType() );
+        controls.remove( control.getID() );
     }
 
 
@@ -237,4 +239,12 @@
         return hash;
     }
 
+
+    public void addAll( Control[] controls ) throws MessageException
+    {
+        for ( Control c : controls )
+        {
+            this.controls.put( c.getID(), c );
+        }
+    }
 }

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractMutableControlImpl.java
(from r569146, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ControlImpl.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractMutableControlImpl.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractMutableControlImpl.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ControlImpl.java&r1=569146&r2=569235&rev=569235&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ControlImpl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractMutableControlImpl.java
Thu Aug 23 20:40:46 2007
@@ -26,14 +26,11 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public abstract class ControlImpl implements Control
+public abstract class AbstractMutableControlImpl implements MutableControl
 {
     /** Unique object identifier for this control */
     private String oid;
 
-    /** Control ASN.1 encoded parameters */
-    private byte[] value;
-
     /** Flag for control criticality */
     private boolean isCritical;
 
@@ -70,50 +67,14 @@
 
 
     /**
-     * Gets the OID of the Control to identify the control type.
-     * 
-     * @return the OID of this Control.
-     */
-    public String getType()
-    {
-        return this.oid;
-    }
-
-
-    /**
      * Sets the OID of the Control to identify the control type.
      * 
      * @param oid
      *            the OID of this Control.
      */
-    public void setType( String oid )
+    public void setID( String oid )
     {
         this.oid = oid;
-    }
-
-
-    /**
-     * Gets the ASN.1 BER encoded value of the control which would have its own
-     * custom ASN.1 defined structure based on the nature of the control.
-     * 
-     * @return ASN.1 BER encoded value as binary data.
-     */
-    public byte[] getValue()
-    {
-        return this.value;
-    }
-
-
-    /**
-     * Sets the ASN.1 BER encoded value of the control which would have its own
-     * custom ASN.1 defined structure based on the nature of the control.
-     * 
-     * @param value
-     *            ASN.1 BER encoded value as binary data.
-     */
-    public void setValue( byte[] value )
-    {
-        this.value = value;
     }
 
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CascadeControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CascadeControl.java?rev=569235&r1=569234&r2=569235&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CascadeControl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CascadeControl.java
Thu Aug 23 20:40:46 2007
@@ -28,7 +28,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev: 437007 $
  */
-public class CascadeControl extends ControlImpl
+public class CascadeControl extends AbstractMutableControlImpl
 {
     private static final long serialVersionUID = -2356861450876343999L;
     public static final String CONTROL_OID = "1.3.6.1.4.1.18060.0.0.1";
@@ -37,7 +37,7 @@
     public CascadeControl()
     {
         super();
-        setType( CONTROL_OID );
+        setID( CONTROL_OID );
     }
 
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/EntryChangeControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/EntryChangeControl.java?rev=569235&r1=569234&r2=569235&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/EntryChangeControl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/EntryChangeControl.java
Thu Aug 23 20:40:46 2007
@@ -21,6 +21,7 @@
 
 
 import org.apache.directory.shared.asn1.codec.EncoderException;
+import org.apache.directory.shared.ldap.codec.ResponseCarryingException;
 import org.apache.directory.shared.ldap.codec.search.controls.ChangeType;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.slf4j.Logger;
@@ -74,7 +75,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class EntryChangeControl extends ControlImpl
+public class EntryChangeControl extends AbstractMutableControlImpl
 {
     private static final long serialVersionUID = -2356861450876343999L;
 
@@ -94,7 +95,7 @@
     public EntryChangeControl()
     {
         super();
-        setType( CONTROL_OID );
+        setID( CONTROL_OID );
     }
 
 
@@ -134,26 +135,22 @@
     }
 
 
-    public byte[] getEncodedValue()
+    public byte[] getEncodedValue() 
     {
-        if ( getValue() == null )
+        // should call this codec or something
+        org.apache.directory.shared.ldap.codec.search.controls.EntryChangeControl ecc = new
org.apache.directory.shared.ldap.codec.search.controls.EntryChangeControl();
+        ecc.setChangeNumber( changeNumber );
+        ecc.setChangeType( changeType );
+        ecc.setPreviousDn( previousDn );
+
+        try
         {
-            // should call this codec or something
-            org.apache.directory.shared.ldap.codec.search.controls.EntryChangeControl ecc
= new org.apache.directory.shared.ldap.codec.search.controls.EntryChangeControl();
-            ecc.setChangeNumber( changeNumber );
-            ecc.setChangeType( changeType );
-            ecc.setPreviousDn( previousDn );
-
-            try
-            {
-                setValue( ecc.encode( null ).array() );
-            }
-            catch ( EncoderException e )
-            {
-                log.error( "Failed to encode psearch control", e );
-            }
+            return ecc.encode( null ).array();
+        }
+        catch ( EncoderException e )
+        {
+            log.error( "Failed to encode psearch control", e );
+            throw new IllegalStateException( "Failed to encode control with encoder.", e
);
         }
-
-        return getValue();
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ManageDsaITControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ManageDsaITControl.java?rev=569235&r1=569234&r2=569235&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ManageDsaITControl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ManageDsaITControl.java
Thu Aug 23 20:40:46 2007
@@ -60,7 +60,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class ManageDsaITControl extends ControlImpl
+public class ManageDsaITControl extends AbstractMutableControlImpl
 {
     public static final String CONTROL_OID = "2.16.840.1.113730.3.4.2";
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/Message.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/Message.java?rev=569235&r1=569234&r2=569235&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/Message.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/Message.java
Thu Aug 23 20:40:46 2007
@@ -22,6 +22,8 @@
 
 import java.util.Map;
 
+import javax.naming.ldap.Control;
+
 
 /**
  * Root interface for all LDAP message type interfaces.
@@ -45,7 +47,7 @@
      * Gets the controls associated with this message mapped by OID.
      * 
      * @return Map of OID strings to Control object instances.
-     * @see Control
+     * @see MutableControl
      */
     Map<String, Control> getControls();
 
@@ -60,6 +62,15 @@
      *             not known etc.
      */
     void add( Control control ) throws MessageException;
+
+
+    /**
+     * Adds an array of controls to this Message.
+     * 
+     * @param controls the controls to add.
+     * @throws MessageException if controls cannot be added to this Message or they are not
known etc.
+     */
+    void addAll( Control[] controls ) throws MessageException;
 
 
     /**

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/MutableControl.java
(from r569146, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/Control.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/MutableControl.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/MutableControl.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/Control.java&r1=569146&r2=569235&rev=569235&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/Control.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/MutableControl.java
Thu Aug 23 20:40:46 2007
@@ -20,6 +20,9 @@
 package org.apache.directory.shared.ldap.message;
 
 
+import javax.naming.ldap.Control;
+
+
 /**
  * Protocol request and response altering control interface. Any number of
  * controls may be associated with a protocol message.
@@ -27,53 +30,15 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public interface Control extends javax.naming.ldap.Control
+public interface MutableControl extends Control
 {
     /**
-     * Gets the OID of the Control to identify the control type.
-     * 
-     * @return the OID of this Control.
-     */
-    String getType();
-
-
-    /**
      * Sets the OID of the Control to identify the control type.
      * 
      * @param oid
      *            the OID of this Control.
      */
-    void setType( String oid );
-
-
-    /**
-     * Gets the ASN.1 BER encoded value of the control which would have its own
-     * custom ASN.1 defined structure based on the nature of the control.
-     * 
-     * @return ASN.1 BER encoded value as binary data.
-     */
-    byte[] getValue();
-
-
-    /**
-     * Sets the ASN.1 BER encoded value of the control which would have its own
-     * custom ASN.1 defined structure based on the nature of the control.
-     * 
-     * @param value
-     *            ASN.1 BER encoded value as binary data.
-     */
-    void setValue( byte[] value );
-
-
-    /**
-     * Determines whether or not this control is critical for the correct
-     * operation of a request or response message. The default for this value
-     * should be false.
-     * 
-     * @return true if the control is critical false otherwise.
-     */
-    boolean isCritical();
-
+    void setID( String oid );
 
     /**
      * Sets the criticil flag which determines whether or not this control is

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/PersistentSearchControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/PersistentSearchControl.java?rev=569235&r1=569234&r2=569235&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/PersistentSearchControl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/PersistentSearchControl.java
Thu Aug 23 20:40:46 2007
@@ -33,7 +33,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class PersistentSearchControl extends ControlImpl
+public class PersistentSearchControl extends AbstractMutableControlImpl
 {
     private static final long serialVersionUID = -2356861450876343999L;
 
@@ -72,7 +72,7 @@
     public PersistentSearchControl()
     {
         super();
-        setType( CONTROL_OID );
+        setID( CONTROL_OID );
     }
 
 
@@ -126,23 +126,19 @@
 
     public byte[] getEncodedValue()
     {
-        if ( getValue() == null )
+        PSearchControl psearchCtl = new PSearchControl();
+        psearchCtl.setChangesOnly( isChangesOnly() );
+        psearchCtl.setChangeTypes( getChangeTypes() );
+        psearchCtl.setReturnECs( isReturnECs() );
+
+        try
         {
-            PSearchControl psearchCtl = new PSearchControl();
-            psearchCtl.setChangesOnly( isChangesOnly() );
-            psearchCtl.setChangeTypes( getChangeTypes() );
-            psearchCtl.setReturnECs( isReturnECs() );
-
-            try
-            {
-                setValue( psearchCtl.encode( null ).array() );
-            }
-            catch ( EncoderException e )
-            {
-                log.error( "Failed to encode psearch control", e );
-            }
+            return psearchCtl.encode( null ).array();
+        }
+        catch ( EncoderException e )
+        {
+            log.error( "Failed to encode psearch control", e );
+            throw new IllegalStateException( "Failed to encode control with encoder.", e
);
         }
-
-        return getValue();
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SubentriesControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SubentriesControl.java?rev=569235&r1=569234&r2=569235&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SubentriesControl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SubentriesControl.java
Thu Aug 23 20:40:46 2007
@@ -67,7 +67,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class SubentriesControl extends ControlImpl
+public class SubentriesControl extends AbstractMutableControlImpl
 {
     private static final long serialVersionUID = -2356861450876343999L;
 
@@ -82,7 +82,7 @@
     public SubentriesControl()
     {
         super();
-        setType( CONTROL_OID );
+        setID( CONTROL_OID );
     }
 
 
@@ -100,21 +100,17 @@
 
     public byte[] getEncodedValue()
     {
-        if ( getValue() == null )
-        {
-            SubEntryControl ctl = new SubEntryControl();
-            ctl.setVisibility( isVisible() );
+        SubEntryControl ctl = new SubEntryControl();
+        ctl.setVisibility( isVisible() );
 
-            try
-            {
-                setValue( ctl.encode( null ).array() );
-            }
-            catch ( EncoderException e )
-            {
-                log.error( "Failed to encode SubentriesControl", e );
-            }
+        try
+        {
+            return ctl.encode( null ).array();
+        }
+        catch ( EncoderException e )
+        {
+            log.error( "Failed to encode SubentriesControl", e );
+            throw new IllegalStateException( "Failed to encode control with encoder.", e
);
         }
-
-        return getValue();
     }
 }

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/AbstractMessageTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/AbstractMessageTest.java?rev=569235&r1=569234&r2=569235&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/AbstractMessageTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/AbstractMessageTest.java
Thu Aug 23 20:40:46 2007
@@ -21,7 +21,7 @@
 
 
 import org.apache.directory.shared.ldap.message.AbstractMessage;
-import org.apache.directory.shared.ldap.message.Control;
+import org.apache.directory.shared.ldap.message.MutableControl;
 import org.apache.directory.shared.ldap.message.MessageTypeEnum;
 
 import junit.framework.TestCase;
@@ -120,7 +120,7 @@
         {
             private static final long serialVersionUID = 1L;
         };
-        msg0.add( new Control()
+        msg0.add( new MutableControl()
         {
             private static final long serialVersionUID = 1L;
 
@@ -131,7 +131,7 @@
             }
 
 
-            public void setType( String a_oid )
+            public void setID( String a_oid )
             {
             }
 

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/AbstractResultResponseTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/AbstractResultResponseTest.java?rev=569235&r1=569234&r2=569235&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/AbstractResultResponseTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/AbstractResultResponseTest.java
Thu Aug 23 20:40:46 2007
@@ -23,7 +23,7 @@
 import javax.naming.InvalidNameException;
 
 import org.apache.directory.shared.ldap.message.AbstractResultResponse;
-import org.apache.directory.shared.ldap.message.Control;
+import org.apache.directory.shared.ldap.message.MutableControl;
 import org.apache.directory.shared.ldap.message.LdapResult;
 import org.apache.directory.shared.ldap.message.MessageTypeEnum;
 import org.apache.directory.shared.ldap.message.Referral;
@@ -183,7 +183,7 @@
         {
             private static final long serialVersionUID = 1L;
         };
-        msg0.add( new Control()
+        msg0.add( new MutableControl()
         {
             private static final long serialVersionUID = 1L;
 
@@ -194,7 +194,7 @@
             }
 
 
-            public void setType( String a_oid )
+            public void setID( String a_oid )
             {
             }
 

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/AddRequestImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/AddRequestImplTest.java?rev=569235&r1=569234&r2=569235&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/AddRequestImplTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/AddRequestImplTest.java
Thu Aug 23 20:40:46 2007
@@ -31,7 +31,6 @@
 import org.apache.directory.shared.ldap.message.AbandonListener;
 import org.apache.directory.shared.ldap.message.AddRequest;
 import org.apache.directory.shared.ldap.message.AddRequestImpl;
-import org.apache.directory.shared.ldap.message.Control;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.MessageException;
@@ -221,12 +220,12 @@
             }
 
 
-            public void add( Control control ) throws MessageException
+            public void add( javax.naming.ldap.Control control ) throws MessageException
             {
             }
 
 
-            public void remove( Control control ) throws MessageException
+            public void remove( javax.naming.ldap.Control control ) throws MessageException
             {
             }
 
@@ -268,6 +267,11 @@
             public ResultResponse getResultResponse()
             {
                 return null;
+            }
+
+
+            public void addAll( javax.naming.ldap.Control[] controls ) throws MessageException
+            {
             }
         };
 

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/BindRequestImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/BindRequestImplTest.java?rev=569235&r1=569234&r2=569235&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/BindRequestImplTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/BindRequestImplTest.java
Thu Aug 23 20:40:46 2007
@@ -26,10 +26,10 @@
 import java.util.Map;
 
 import javax.naming.InvalidNameException;
+import javax.naming.ldap.Control;
 
 import org.apache.directory.shared.ldap.message.BindRequest;
 import org.apache.directory.shared.ldap.message.BindRequestImpl;
-import org.apache.directory.shared.ldap.message.Control;
 import org.apache.directory.shared.ldap.message.MessageException;
 import org.apache.directory.shared.ldap.message.MessageTypeEnum;
 import org.apache.directory.shared.ldap.message.ResultResponse;
@@ -267,12 +267,12 @@
             }
 
 
-            public void add( Control a_control ) throws MessageException
+            public void add( Control control ) throws MessageException
             {
             }
 
 
-            public void remove( Control a_control ) throws MessageException
+            public void remove( Control control ) throws MessageException
             {
             }
 
@@ -309,6 +309,11 @@
             public ResultResponse getResultResponse()
             {
                 return null;
+            }
+
+
+            public void addAll( Control[] controls ) throws MessageException
+            {
             }
         };
 

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/CompareRequestImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/CompareRequestImplTest.java?rev=569235&r1=569234&r2=569235&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/CompareRequestImplTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/CompareRequestImplTest.java
Thu Aug 23 20:40:46 2007
@@ -26,11 +26,11 @@
 import java.util.Map;
 
 import javax.naming.InvalidNameException;
+import javax.naming.ldap.Control;
 
 import org.apache.directory.shared.ldap.message.AbandonListener;
 import org.apache.directory.shared.ldap.message.CompareRequest;
 import org.apache.directory.shared.ldap.message.CompareRequestImpl;
-import org.apache.directory.shared.ldap.message.Control;
 import org.apache.directory.shared.ldap.message.MessageException;
 import org.apache.directory.shared.ldap.message.MessageTypeEnum;
 import org.apache.directory.shared.ldap.message.ResultResponse;
@@ -251,6 +251,11 @@
             public ResultResponse getResultResponse()
             {
                 return null;
+            }
+
+
+            public void addAll( Control[] controls ) throws MessageException
+            {
             }
         };
 

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/DeleteRequestImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/DeleteRequestImplTest.java?rev=569235&r1=569234&r2=569235&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/DeleteRequestImplTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/DeleteRequestImplTest.java
Thu Aug 23 20:40:46 2007
@@ -26,9 +26,9 @@
 import java.util.Map;
 
 import javax.naming.InvalidNameException;
+import javax.naming.ldap.Control;
 
 import org.apache.directory.shared.ldap.message.AbandonListener;
-import org.apache.directory.shared.ldap.message.Control;
 import org.apache.directory.shared.ldap.message.DeleteRequest;
 import org.apache.directory.shared.ldap.message.DeleteRequestImpl;
 import org.apache.directory.shared.ldap.message.MessageException;
@@ -190,6 +190,11 @@
             public ResultResponse getResultResponse()
             {
                 return null;
+            }
+
+
+            public void addAll( Control[] controls ) throws MessageException
+            {
             }
         };
 

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ExtendedRequestImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ExtendedRequestImplTest.java?rev=569235&r1=569234&r2=569235&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ExtendedRequestImplTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ExtendedRequestImplTest.java
Thu Aug 23 20:40:46 2007
@@ -26,9 +26,9 @@
 import java.util.Map;
 
 import javax.naming.NamingException;
+import javax.naming.ldap.Control;
 import javax.naming.ldap.ExtendedResponse;
 
-import org.apache.directory.shared.ldap.message.Control;
 import org.apache.directory.shared.ldap.message.ExtendedRequest;
 import org.apache.directory.shared.ldap.message.ExtendedRequestImpl;
 import org.apache.directory.shared.ldap.message.MessageException;
@@ -172,7 +172,7 @@
             }
 
 
-            public Map getControls()
+            public Map<String,Control> getControls()
             {
                 return Collections.EMPTY_MAP;
             }
@@ -228,6 +228,11 @@
                 throws NamingException
             {
                 return null;
+            }
+
+
+            public void addAll( Control[] controls ) throws MessageException
+            {
             }
         };
 

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ExtendedResponseImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ExtendedResponseImplTest.java?rev=569235&r1=569234&r2=569235&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ExtendedResponseImplTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ExtendedResponseImplTest.java
Thu Aug 23 20:40:46 2007
@@ -26,8 +26,8 @@
 import java.util.Map;
 
 import javax.naming.InvalidNameException;
+import javax.naming.ldap.Control;
 
-import org.apache.directory.shared.ldap.message.Control;
 import org.apache.directory.shared.ldap.message.ExtendedResponse;
 import org.apache.directory.shared.ldap.message.ExtendedResponseImpl;
 import org.apache.directory.shared.ldap.message.LdapResult;
@@ -207,6 +207,11 @@
             public byte[] getEncodedValue()
             {
                 return getResponse();
+            }
+
+
+            public void addAll( Control[] controls ) throws MessageException
+            {
             }
         };
 

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModifyDnRequestImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModifyDnRequestImplTest.java?rev=569235&r1=569234&r2=569235&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModifyDnRequestImplTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModifyDnRequestImplTest.java
Thu Aug 23 20:40:46 2007
@@ -26,9 +26,9 @@
 import java.util.Map;
 
 import javax.naming.InvalidNameException;
+import javax.naming.ldap.Control;
 
 import org.apache.directory.shared.ldap.message.AbandonListener;
-import org.apache.directory.shared.ldap.message.Control;
 import org.apache.directory.shared.ldap.message.MessageException;
 import org.apache.directory.shared.ldap.message.MessageTypeEnum;
 import org.apache.directory.shared.ldap.message.ModifyDnRequest;
@@ -333,6 +333,11 @@
             public ResultResponse getResultResponse()
             {
                 return null;
+            }
+
+
+            public void addAll( Control[] controls ) throws MessageException
+            {
             }
         };
 

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModifyRequestImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModifyRequestImplTest.java?rev=569235&r1=569234&r2=569235&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModifyRequestImplTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModifyRequestImplTest.java
Thu Aug 23 20:40:46 2007
@@ -24,9 +24,9 @@
 
 import javax.naming.InvalidNameException;
 import javax.naming.directory.DirContext;
+import javax.naming.ldap.Control;
 
 import org.apache.directory.shared.ldap.message.AbandonListener;
-import org.apache.directory.shared.ldap.message.Control;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.MessageException;
 import org.apache.directory.shared.ldap.message.MessageTypeEnum;
@@ -375,6 +375,11 @@
             public ResultResponse getResultResponse()
             {
                 return null;
+            }
+
+
+            public void addAll( Control[] controls ) throws MessageException
+            {
             }
         };
 

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseDoneImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseDoneImplTest.java?rev=569235&r1=569234&r2=569235&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseDoneImplTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseDoneImplTest.java
Thu Aug 23 20:40:46 2007
@@ -26,8 +26,8 @@
 import java.util.Map;
 
 import javax.naming.InvalidNameException;
+import javax.naming.ldap.Control;
 
-import org.apache.directory.shared.ldap.message.Control;
 import org.apache.directory.shared.ldap.message.LdapResult;
 import org.apache.directory.shared.ldap.message.LdapResultImpl;
 import org.apache.directory.shared.ldap.message.MessageException;
@@ -167,6 +167,11 @@
             public Object put( Object a_key, Object a_value )
             {
                 return null;
+            }
+
+
+            public void addAll( Control[] controls ) throws MessageException
+            {
             }
         };
 

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseEntryImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseEntryImplTest.java?rev=569235&r1=569234&r2=569235&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseEntryImplTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseEntryImplTest.java
Thu Aug 23 20:40:46 2007
@@ -27,8 +27,8 @@
 
 import javax.naming.InvalidNameException;
 import javax.naming.directory.Attributes;
+import javax.naming.ldap.Control;
 
-import org.apache.directory.shared.ldap.message.Control;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.MessageException;
@@ -180,6 +180,11 @@
             public Object put( Object key, Object value )
             {
                 return null;
+            }
+
+
+            public void addAll( Control[] controls ) throws MessageException
+            {
             }
         };
 

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseReferenceImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseReferenceImplTest.java?rev=569235&r1=569234&r2=569235&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseReferenceImplTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseReferenceImplTest.java
Thu Aug 23 20:40:46 2007
@@ -25,7 +25,8 @@
 import java.util.Collections;
 import java.util.Map;
 
-import org.apache.directory.shared.ldap.message.Control;
+import javax.naming.ldap.Control;
+
 import org.apache.directory.shared.ldap.message.MessageException;
 import org.apache.directory.shared.ldap.message.MessageTypeEnum;
 import org.apache.directory.shared.ldap.message.Referral;
@@ -142,6 +143,11 @@
             public Object put( Object key, Object value )
             {
                 return null;
+            }
+
+
+            public void addAll( Control[] controls ) throws MessageException
+            {
             }
         };
 



Mime
View raw message