directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r1063103 - in /directory: apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/ shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/ shared/trunk/ldap/src/main/java/org/apache/directory/shared...
Date Tue, 25 Jan 2011 02:10:34 GMT
Author: akarasulu
Date: Tue Jan 25 02:10:33 2011
New Revision: 1063103

URL: http://svn.apache.org/viewvc?rev=1063103&view=rev
Log:
added encoding decorator to decouple CompareResponseImpl

Added:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/CompareResponseDecorator.java
      - copied, changed from r1063097, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/FooDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/CompareResponseImpl.java
  (contents, props changed)
      - copied, changed from r1063102, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareResponseImpl.java
Removed:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareResponseImpl.java
Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java
    directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/CompareResponseDsml.java
    directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/Dsmlv2ResponseGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapEncoder.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/MessageDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/CompareNoDResponse.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/CompareRequestImpl.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/compare/CompareRequestTest.java

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java?rev=1063103&r1=1063102&r2=1063103&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java
Tue Jan 25 02:10:33 2011
@@ -58,7 +58,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.CompareRequest;
 import org.apache.directory.shared.ldap.model.message.CompareRequestImpl;
 import org.apache.directory.shared.ldap.model.message.CompareResponse;
-import org.apache.directory.shared.ldap.message.CompareResponseImpl;
+import org.apache.directory.shared.ldap.model.message.CompareResponseImpl;
 import org.apache.directory.shared.ldap.model.message.DeleteRequest;
 import org.apache.directory.shared.ldap.message.DeleteRequestImpl;
 import org.apache.directory.shared.ldap.model.message.DeleteResponse;

Modified: directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/CompareResponseDsml.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/CompareResponseDsml.java?rev=1063103&r1=1063102&r2=1063103&view=diff
==============================================================================
--- directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/CompareResponseDsml.java
(original)
+++ directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/CompareResponseDsml.java
Tue Jan 25 02:10:33 2011
@@ -21,9 +21,9 @@
 package org.apache.directory.shared.dsmlv2.reponse;
 
 
+import org.apache.directory.shared.ldap.model.message.CompareResponseImpl;
 import org.apache.directory.shared.ldap.model.message.MessageTypeEnum;
 import org.apache.directory.shared.ldap.model.message.CompareResponse;
-import org.apache.directory.shared.ldap.message.CompareResponseImpl;
 import org.dom4j.Element;
 
 

Modified: directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/Dsmlv2ResponseGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/Dsmlv2ResponseGrammar.java?rev=1063103&r1=1063102&r2=1063103&view=diff
==============================================================================
--- directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/Dsmlv2ResponseGrammar.java
(original)
+++ directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/Dsmlv2ResponseGrammar.java
Tue Jan 25 02:10:33 2011
@@ -49,7 +49,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.BindResponse;
 import org.apache.directory.shared.ldap.model.message.BindResponseImpl;
 import org.apache.directory.shared.ldap.model.message.CompareResponse;
-import org.apache.directory.shared.ldap.message.CompareResponseImpl;
+import org.apache.directory.shared.ldap.model.message.CompareResponseImpl;
 import org.apache.directory.shared.ldap.model.message.DeleteResponse;
 import org.apache.directory.shared.ldap.message.DeleteResponseImpl;
 import org.apache.directory.shared.ldap.model.message.ExtendedResponse;

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java?rev=1063103&r1=1063102&r2=1063103&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
Tue Jan 25 02:10:33 2011
@@ -82,7 +82,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.CompareRequest;
 import org.apache.directory.shared.ldap.model.message.CompareRequestImpl;
 import org.apache.directory.shared.ldap.model.message.CompareResponse;
-import org.apache.directory.shared.ldap.message.CompareResponseImpl;
+import org.apache.directory.shared.ldap.model.message.CompareResponseImpl;
 import org.apache.directory.shared.ldap.model.message.DeleteRequest;
 import org.apache.directory.shared.ldap.message.DeleteRequestImpl;
 import org.apache.directory.shared.ldap.model.message.DeleteResponse;

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapEncoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapEncoder.java?rev=1063103&r1=1063102&r2=1063103&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapEncoder.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapEncoder.java
Tue Jan 25 02:10:33 2011
@@ -657,11 +657,12 @@ public class LdapEncoder
      * 
      * Length(CompareResponse) = Length(0x6F) + Length(L1) + L1
      */
-    private int computeCompareResponseLength( CompareResponseImpl compareResponse )
+    private int computeCompareResponseLength( CompareResponseDecorator decorator )
     {
+        CompareResponse compareResponse = decorator.getCompareResponse();
         int compareResponseLength = computeLdapResultLength( compareResponse.getLdapResult()
);
 
-        compareResponse.setCompareResponseLength( compareResponseLength );
+        decorator.setCompareResponseLength( compareResponseLength );
 
         return 1 + TLV.getNbBytes( compareResponseLength ) + compareResponseLength;
     }
@@ -1671,14 +1672,15 @@ public class LdapEncoder
      * 
      * @param buffer The buffer where to put the PDU
      */
-    private void encodeCompareResponse( ByteBuffer buffer, CompareResponseImpl compareResponse
)
+    private void encodeCompareResponse( ByteBuffer buffer, CompareResponseDecorator decorator
)
         throws EncoderException
     {
+        CompareResponse compareResponse = decorator.getCompareResponse();
         try
         {
             // The CompareResponse Tag
             buffer.put( LdapConstants.COMPARE_RESPONSE_TAG );
-            buffer.put( TLV.getBytes( compareResponse.getCompareResponseLength() ) );
+            buffer.put( TLV.getBytes( decorator.getCompareResponseLength() ) );
 
             // The LdapResult
             encodeLdapResult( buffer, compareResponse.getLdapResult() );
@@ -2388,7 +2390,7 @@ public class LdapEncoder
                 return computeCompareRequestLength( ( CompareRequestDecorator ) decorator
);
 
             case COMPARE_RESPONSE:
-                return computeCompareResponseLength( ( CompareResponseImpl ) message );
+                return computeCompareResponseLength( ( CompareResponseDecorator ) decorator
);
 
             case DEL_REQUEST:
                 return computeDeleteRequestLength( ( DeleteRequestImpl ) message );
@@ -2469,7 +2471,7 @@ public class LdapEncoder
                 break;
 
             case COMPARE_RESPONSE:
-                encodeCompareResponse( bb, ( CompareResponseImpl ) message );
+                encodeCompareResponse( bb, ( CompareResponseDecorator ) decorator );
                 break;
 
             case DEL_REQUEST:

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/CompareResponseDecorator.java
(from r1063097, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/FooDecorator.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/CompareResponseDecorator.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/CompareResponseDecorator.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/FooDecorator.java&r1=1063097&r2=1063103&rev=1063103&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/FooDecorator.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/CompareResponseDecorator.java
Tue Jan 25 02:10:33 2011
@@ -20,9 +20,7 @@
 package org.apache.directory.shared.ldap.message.decorators;
 
 
-import org.apache.directory.shared.ldap.model.message.AddRequest;
-
-import java.util.List;
+import org.apache.directory.shared.ldap.model.message.CompareResponse;
 
 
 /**
@@ -30,22 +28,44 @@ import java.util.List;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class FooDecorator extends MessageDecorator
+public class CompareResponseDecorator extends MessageDecorator
 {
+    /** The encoded compareResponse length */
+    private int compareResponseLength;
+
 
     /**
-     * Makes a Foo encodable.
+     * Makes a CompareResponse encodable.
      *
-     * @param decoratedMessage the decorated Foo
+     * @param decoratedMessage the decorated CompareResponse
      */
-    public FooDecorator( AddRequest decoratedMessage )
+    public CompareResponseDecorator( CompareResponse decoratedMessage )
     {
         super( decoratedMessage );
     }
 
 
-    public AddRequest getAddRequest()
+    public CompareResponse getCompareResponse()
+    {
+        return ( CompareResponse ) getMessage();
+    }
+
+
+    /**
+     * Stores the encoded length for the CompareResponse
+     * @param compareResponseLength The encoded length
+     */
+    public void setCompareResponseLength( int compareResponseLength )
+    {
+        this.compareResponseLength = compareResponseLength;
+    }
+
+
+    /**
+     * @return The encoded CompareResponse's length
+     */
+    public int getCompareResponseLength()
     {
-        return ( AddRequest ) getMessage();
+        return compareResponseLength;
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/MessageDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/MessageDecorator.java?rev=1063103&r1=1063102&r2=1063103&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/MessageDecorator.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/decorators/MessageDecorator.java
Tue Jan 25 02:10:33 2011
@@ -61,6 +61,8 @@ public class MessageDecorator
                 return new BindResponseDecorator( ( BindResponse ) decoratedMessage );
             case COMPARE_REQUEST:
                 return new CompareRequestDecorator( ( CompareRequest ) decoratedMessage );
+            case COMPARE_RESPONSE:
+                return new CompareResponseDecorator( ( CompareResponse ) decoratedMessage
);
             default:
                 return new MessageDecorator( decoratedMessage );
         }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/CompareNoDResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/CompareNoDResponse.java?rev=1063103&r1=1063102&r2=1063103&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/CompareNoDResponse.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/CompareNoDResponse.java
Tue Jan 25 02:10:33 2011
@@ -21,7 +21,7 @@ package org.apache.directory.shared.ldap
 
 
 import org.apache.directory.shared.i18n.I18n;
-import org.apache.directory.shared.ldap.message.CompareResponseImpl;
+import org.apache.directory.shared.ldap.model.message.CompareResponseImpl;
 import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.message.extended.NoticeOfDisconnect;
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/CompareRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/CompareRequestImpl.java?rev=1063103&r1=1063102&r2=1063103&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/CompareRequestImpl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/CompareRequestImpl.java
Tue Jan 25 02:10:33 2011
@@ -20,8 +20,6 @@
 package org.apache.directory.shared.ldap.model.message;
 
 
-import org.apache.directory.shared.ldap.message.CompareResponseImpl;
-import org.apache.directory.shared.ldap.model.message.*;
 import org.apache.directory.shared.ldap.model.entry.BinaryValue;
 import org.apache.directory.shared.ldap.model.entry.StringValue;
 import org.apache.directory.shared.ldap.model.entry.Value;

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/CompareResponseImpl.java
(from r1063102, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareResponseImpl.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/CompareResponseImpl.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/CompareResponseImpl.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareResponseImpl.java&r1=1063102&r2=1063103&rev=1063103&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareResponseImpl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/CompareResponseImpl.java
Tue Jan 25 02:10:33 2011
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.message;
+package org.apache.directory.shared.ldap.model.message;
 
 
 import org.apache.directory.shared.ldap.model.message.AbstractResultResponse;
@@ -32,13 +32,6 @@ import org.apache.directory.shared.ldap.
  */
 public class CompareResponseImpl extends AbstractResultResponse implements CompareResponse
 {
-    /** The encoded compareResponse length */
-    private int compareResponseLength;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
     static final long serialVersionUID = 6452521899386487731L;
 
 
@@ -63,25 +56,6 @@ public class CompareResponseImpl extends
 
 
     /**
-     * Stores the encoded length for the CompareResponse
-     * @param compareResponseLength The encoded length
-     */
-    /* No qualifier*/void setCompareResponseLength( int compareResponseLength )
-    {
-        this.compareResponseLength = compareResponseLength;
-    }
-
-
-    /**
-     * @return The encoded CompareResponse's length
-     */
-    /* No qualifier*/int getCompareResponseLength()
-    {
-        return compareResponseLength;
-    }
-
-
-    /**
      * {@inheritDoc}
      */
     public boolean isTrue()

Propchange: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/CompareResponseImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/compare/CompareRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/compare/CompareRequestTest.java?rev=1063103&r1=1063102&r2=1063103&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/compare/CompareRequestTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/compare/CompareRequestTest.java
Tue Jan 25 02:10:33 2011
@@ -36,7 +36,7 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.ResponseCarryingException;
 import org.apache.directory.shared.ldap.model.message.CompareRequest;
-import org.apache.directory.shared.ldap.message.CompareResponseImpl;
+import org.apache.directory.shared.ldap.model.message.CompareResponseImpl;
 import org.apache.directory.shared.ldap.message.LdapEncoder;
 import org.apache.directory.shared.ldap.model.message.Control;
 import org.apache.directory.shared.ldap.model.message.Message;



Mime
View raw message