directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1579895 - in /directory/shared/trunk/ldap/extras/codec/src: main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/cancel/ main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/certGeneration/ main/java/org/apache/dire...
Date Fri, 21 Mar 2014 07:28:09 GMT
Author: elecharny
Date: Fri Mar 21 07:28:08 2014
New Revision: 1579895

URL: http://svn.apache.org/r1579895
Log:
o Renamed the encode and computeLength to encodeInternal and computeLengthInternal
o Made those methods package protected
o Moved some tests into sub-packages to be able to call the package protected methods
o Updated the Javadoc
o Fixed some badly used tag

Added:
    directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/cancel/
    directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/cancel/CancelRequestTest.java
      - copied, changed from r1578980, directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/CancelRequestTest.java
    directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/certGeneration/
    directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/certGeneration/CertGenerationRequestTest.java
      - copied, changed from r1579091, directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/CertGenerationRequestTest.java
    directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/gracefulDisconnect/
    directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/gracefulDisconnect/GracefulDisconnectResponseTest.java
      - copied, changed from r1579743, directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/GracefulDisconnectResponseTest.java
    directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/gracefulShutdown/
    directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/gracefulShutdown/GracefulShutdownTest.java
      - copied, changed from r1579091, directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/GracefulShutdownTest.java
    directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/storedProcedure/
    directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/storedProcedure/StoredProcedureTest.java
      - copied, changed from r1578136, directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/StoredProcedureTest.java
Removed:
    directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/CancelRequestTest.java
    directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/CertGenerationRequestTest.java
    directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/GracefulDisconnectResponseTest.java
    directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/GracefulShutdownTest.java
    directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/StoredProcedureTest.java
Modified:
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/cancel/CancelRequestDecorator.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/certGeneration/CertGenerationRequestDecorator.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/gracefulDisconnect/GracefulDisconnectResponseDecorator.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/gracefulShutdown/GracefulShutdownRequestDecorator.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyRequestDecorator.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseConstants.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseDecorator.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseGrammar.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/storedProcedure/StoredProcedureRequestDecorator.java

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/cancel/CancelRequestDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/cancel/CancelRequestDecorator.java?rev=1579895&r1=1579894&r2=1579895&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/cancel/CancelRequestDecorator.java
(original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/cancel/CancelRequestDecorator.java
Fri Mar 21 07:28:08 2014
@@ -93,7 +93,7 @@ public class CancelRequestDecorator exte
         {
             try
             {
-                requestValue = encode().array();
+                requestValue = encodeInternal().array();
             }
             catch ( EncoderException e )
             {
@@ -147,7 +147,7 @@ public class CancelRequestDecorator exte
      *   | 
      *   +--> 0x02 0x0(1-4) [0..2^31-1] 
      */
-    public int computeLength()
+    /* no qualifier */ int computeLengthInternal()
     {
         // The messageId length
         cancelSequenceLength = 1 + 1 + BerValue.getNbBytes( cancelRequest.getCancelId() );
@@ -163,10 +163,10 @@ public class CancelRequestDecorator exte
      * @return A ByteBuffer that contains the encoded PDU
      * @throws org.apache.directory.api.asn1.EncoderException If anything goes wrong.
      */
-    public ByteBuffer encode() throws EncoderException
+    /* no qualifier */ ByteBuffer encodeInternal() throws EncoderException
     {
         // Allocate the bytes buffer.
-        ByteBuffer bb = ByteBuffer.allocate( computeLength() );
+        ByteBuffer bb = ByteBuffer.allocate( computeLengthInternal() );
 
         // The sequence
         bb.put( UniversalTag.SEQUENCE.getValue() );

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/certGeneration/CertGenerationRequestDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/certGeneration/CertGenerationRequestDecorator.java?rev=1579895&r1=1579894&r2=1579895&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/certGeneration/CertGenerationRequestDecorator.java
(original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/certGeneration/CertGenerationRequestDecorator.java
Fri Mar 21 07:28:08 2014
@@ -104,7 +104,7 @@ public class CertGenerationRequestDecora
         {
             try
             {
-                requestValue = encode().array();
+                requestValue = encodeInternal().array();
             }
             catch ( EncoderException e )
             {
@@ -207,9 +207,18 @@ public class CertGenerationRequestDecora
 
 
     /**
-     * {@inheritDoc}
+     * Compute the CertGenerationRequest length 
+     * 
+     * <pre>
+     * 0x30 L1 
+     *   | 
+     *   +--> 0x04 LL target DN
+     *   +--> 0x04 LL issuer DN
+     *   +--> 0x04 LL subject DN
+     *   +--> 0x04 LL key algorithm
+     * </pre>
      */
-    public int computeLength()
+    /* no qualifier */ int computeLengthInternal()
     {
         int len = Strings.getBytesUtf8( certGenerationRequest.getTargetDN() ).length;
         requestLength = 1 + BerValue.getNbBytes( len ) + len;
@@ -228,23 +237,15 @@ public class CertGenerationRequestDecora
 
 
     /**
-     * {@inheritDoc}
+     * Encodes the CertGenerationRequest extended operation.
+     * 
+     * @return A ByteBuffer that contains the encoded PDU
+     * @throws org.apache.directory.api.asn1.EncoderException If anything goes wrong.
      */
-    public ByteBuffer encode() throws EncoderException
+    /* no qualifier */ ByteBuffer encodeInternal() throws EncoderException
     {
         // Allocate the bytes buffer.
-        ByteBuffer bb = ByteBuffer.allocate( computeLength() );
-
-        return encode( bb );
-    }
-
-
-    public ByteBuffer encode( ByteBuffer bb ) throws EncoderException
-    {
-        if ( bb == null )
-        {
-            throw new EncoderException( "Null ByteBuffer, cannot encode " + this );
-        }
+        ByteBuffer bb = ByteBuffer.allocate( computeLengthInternal() );
 
         bb.put( UniversalTag.SEQUENCE.getValue() );
         bb.put( BerValue.getBytes( requestLength ) );

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/gracefulDisconnect/GracefulDisconnectResponseDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/gracefulDisconnect/GracefulDisconnectResponseDecorator.java?rev=1579895&r1=1579894&r2=1579895&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/gracefulDisconnect/GracefulDisconnectResponseDecorator.java
(original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/gracefulDisconnect/GracefulDisconnectResponseDecorator.java
Fri Mar 21 07:28:08 2014
@@ -88,7 +88,7 @@ public class GracefulDisconnectResponseD
         {
             try
             {
-                responseValue = encode().array();
+                responseValue = encodeInternal().array();
             }
             catch ( EncoderException e )
             {
@@ -186,7 +186,7 @@ public class GracefulDisconnectResponseD
 
     /**
      * Compute the GracefulDisconnect length 
-     * 
+     * <pre>
      * 0x30 L1 
      *   | 
      *   +--> [ 0x02 0x0(1-4) [0..720] ] 
@@ -194,8 +194,9 @@ public class GracefulDisconnectResponseD
      *   +--> [ 0x30 L2 
      *           | 
      *           +--> (0x04 L3 value) + ]
+     * </pre>
      */
-    public int computeLength()
+    /* no qualifier */ int computeLengthInternal()
     {
         gracefulDisconnectSequenceLength = 0;
 
@@ -234,29 +235,16 @@ public class GracefulDisconnectResponseD
 
 
     /**
-     * {@inheritDoc}
-     */
-    public ByteBuffer encode() throws EncoderException
-    {
-        // Allocate the bytes buffer.
-        ByteBuffer bb = ByteBuffer.allocate( computeLength() );
-
-        return encode( bb );
-    }
-
-
-    /**
      * Encodes the gracefulDisconnect extended operation.
      * 
      * @return A ByteBuffer that contains the encoded PDU
      * @throws org.apache.directory.api.asn1.EncoderException If anything goes wrong.
      */
-    public ByteBuffer encode( ByteBuffer bb ) throws EncoderException
+    /* no qualifier */ ByteBuffer encodeInternal() throws EncoderException
     {
-        if ( bb == null )
-        {
-            throw new EncoderException( "Null ByteBuffer, cannot encode " + this );
-        }
+        // Allocate the bytes buffer.
+        ByteBuffer bb = ByteBuffer.allocate( computeLengthInternal() );
+
 
         bb.put( UniversalTag.SEQUENCE.getValue() );
         bb.put( TLV.getBytes( gracefulDisconnectSequenceLength ) );

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/gracefulShutdown/GracefulShutdownRequestDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/gracefulShutdown/GracefulShutdownRequestDecorator.java?rev=1579895&r1=1579894&r2=1579895&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/gracefulShutdown/GracefulShutdownRequestDecorator.java
(original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/gracefulShutdown/GracefulShutdownRequestDecorator.java
Fri Mar 21 07:28:08 2014
@@ -102,7 +102,7 @@ public class GracefulShutdownRequestDeco
         {
             try
             {
-                requestValue = encode().array();
+                requestValue = encodeInternal().array();
             }
             catch ( EncoderException e )
             {
@@ -153,14 +153,16 @@ public class GracefulShutdownRequestDeco
 
     /**
      * Compute the GracefulShutdown length 
+     * 
+     * <pre>
      * 0x30 L1 
      *   | 
      *   +--> [0x02 0x0(1-4) [0..720] ] 
      *   +--> [0x80 0x0(1-3) [0..86400] ] 
-     *   
+     * </pre>  
      * L1 will always be &lt 11.
      */
-    public int computeLength()
+    /* no qualifier */ int computeLengthInternal()
     {
         int gracefulLength = 1 + 1;
         gracefulSequenceLength = 0;
@@ -180,29 +182,15 @@ public class GracefulShutdownRequestDeco
 
 
     /**
-     * {@inheritDoc}
-     */
-    public ByteBuffer encode() throws EncoderException
-    {
-        // Allocate the bytes buffer.
-        ByteBuffer bb = ByteBuffer.allocate( computeLength() );
-
-        return encode( bb );
-    }
-
-
-    /**
      * Encodes the gracefulShutdown extended operation.
      * 
      * @return A ByteBuffer that contains the encoded PDU
      * @throws org.apache.directory.api.asn1.EncoderException If anything goes wrong.
      */
-    public ByteBuffer encode( ByteBuffer bb ) throws EncoderException
+    /* no qualifier */ ByteBuffer encodeInternal() throws EncoderException
     {
-        if ( bb == null )
-        {
-            throw new EncoderException( "Null ByteBuffer, cannot encode " + this );
-        }
+        // Allocate the bytes buffer.
+        ByteBuffer bb = ByteBuffer.allocate( computeLengthInternal() );
 
         bb.put( UniversalTag.SEQUENCE.getValue() );
         bb.put( TLV.getBytes( gracefulSequenceLength ) );

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyRequestDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyRequestDecorator.java?rev=1579895&r1=1579894&r2=1579895&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyRequestDecorator.java
(original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyRequestDecorator.java
Fri Mar 21 07:28:08 2014
@@ -183,7 +183,14 @@ public class PasswordModifyRequestDecora
 
 
     /**
-     * {@inheritDoc}
+     * Compute the PasswordModifyRequest extended operation length
+     * <pre>
+     * 0x30 L1 
+     *   | 
+     *  [+-- 0x80 L2 userIdentity] 
+     *  [+-- 0x81 L3 oldPassword] 
+     *  [+-- 0x82 L4 newPassword] 
+     * </pre>
      */
     /* No qualifier */ int computeLengthInternal()
     {
@@ -212,7 +219,10 @@ public class PasswordModifyRequestDecora
 
 
     /**
-     * {@inheritDoc}
+     * Encodes the PasswordModifyRequest extended operation.
+     * 
+     * @return A ByteBuffer that contains the encoded PDU
+     * @throws org.apache.directory.api.asn1.EncoderException If anything goes wrong.
      */
     /* No qualifier */ ByteBuffer encodeInternal() throws EncoderException
     {

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseConstants.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseConstants.java?rev=1579895&r1=1579894&r2=1579895&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseConstants.java
(original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseConstants.java
Fri Mar 21 07:28:08 2014
@@ -28,7 +28,7 @@ package org.apache.directory.api.ldap.ex
 public final class PasswordModifyResponseConstants
 {
     /** This is the TAG used for the genPassword. It's a contextual primitive Tag */
-    public static final int GEN_PASSORWD_TAG = 0x80;
+    public static final int GEN_PASSWORD_TAG = 0x80;
 
 
     /**

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseDecorator.java?rev=1579895&r1=1579894&r2=1579895&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseDecorator.java
(original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseDecorator.java
Fri Mar 21 07:28:08 2014
@@ -146,7 +146,12 @@ public class PasswordModifyResponseDecor
 
 
     /**
-     * {@inheritDoc}
+     * Compute the PasswordModifyResponse extended operation length
+     * <pre>
+     * 0x30 L1 
+     *   | 
+     *  [+-- 0x80 L2 genPassword] 
+     * </pre>
      */
     /* no qualifier */ int computeLengthInternal()
     {
@@ -163,7 +168,10 @@ public class PasswordModifyResponseDecor
 
 
     /**
-     * {@inheritDoc}
+     * Encodes the PasswordModifyResponse extended operation.
+     * 
+     * @return A ByteBuffer that contains the encoded PDU
+     * @throws org.apache.directory.api.asn1.EncoderException If anything goes wrong.
      */
     /* no qualifier */ ByteBuffer encodeInternal() throws EncoderException
     {
@@ -176,7 +184,7 @@ public class PasswordModifyResponseDecor
         if ( passwordModifyResponse.getGenPassword() != null )
         {
             byte[] userIdentity = passwordModifyResponse.getGenPassword();
-            bb.put( ( byte ) PasswordModifyRequestConstants.USER_IDENTITY_TAG );
+            bb.put( ( byte ) PasswordModifyResponseConstants.GEN_PASSWORD_TAG );
             bb.put( TLV.getBytes( userIdentity.length ) );
             bb.put( userIdentity );
         }

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseGrammar.java?rev=1579895&r1=1579894&r2=1579895&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseGrammar.java
(original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseGrammar.java
Fri Mar 21 07:28:08 2014
@@ -104,11 +104,11 @@ public class PasswordModifyResponseGramm
          *     
          * Set the userIdentity into the PasswdModifyResponset instance.
          */
-        super.transitions[PasswordModifyResponseStatesEnum.PASSWORD_MODIFY_RESPONSE_SEQUENCE_STATE.ordinal()][PasswordModifyResponseConstants.GEN_PASSORWD_TAG]
=
+        super.transitions[PasswordModifyResponseStatesEnum.PASSWORD_MODIFY_RESPONSE_SEQUENCE_STATE.ordinal()][PasswordModifyResponseConstants.GEN_PASSWORD_TAG]
=
             new GrammarTransition<PasswordModifyResponseContainer>(
                 PasswordModifyResponseStatesEnum.PASSWORD_MODIFY_RESPONSE_SEQUENCE_STATE,
                 PasswordModifyResponseStatesEnum.GEN_PASSWORD_STATE,
-                PasswordModifyResponseConstants.GEN_PASSORWD_TAG,
+                PasswordModifyResponseConstants.GEN_PASSWORD_TAG,
                 new GrammarAction<PasswordModifyResponseContainer>( "Set PasswordModifyResponse
user identity" )
                 {
                     public void action( PasswordModifyResponseContainer container ) throws
DecoderException

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/storedProcedure/StoredProcedureRequestDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/storedProcedure/StoredProcedureRequestDecorator.java?rev=1579895&r1=1579894&r2=1579895&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/storedProcedure/StoredProcedureRequestDecorator.java
(original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/storedProcedure/StoredProcedureRequestDecorator.java
Fri Mar 21 07:28:08 2014
@@ -98,7 +98,7 @@ public class StoredProcedureRequestDecor
 
     /**
      * Compute the StoredProcedure length 
-     * 
+     * <pre>
      * 0x30 L1 
      *   | 
      *   +--> 0x04 L2 language
@@ -121,8 +121,9 @@ public class StoredProcedureRequestDecor
      *                 |
      *                 +--> 0x04 L6-m type
      *                 +--> 0x04 L7-m value
+     * </pre>
      */
-    public int computeLength()
+    /* no qualifier */ int computeLengthInternal()
     {
         // The language
         byte[] languageBytes = Strings.getBytesUtf8( getDecorated().getLanguage() );
@@ -170,14 +171,15 @@ public class StoredProcedureRequestDecor
 
 
     /**
-     * Encode the StoredProcedure message to a PDU. 
+     * Encodes the StoredProcedure extended operation.
      * 
-     * @return The PDU.
+     * @return A ByteBuffer that contains the encoded PDU
+     * @throws org.apache.directory.api.asn1.EncoderException If anything goes wrong.
      */
-    public ByteBuffer encode() throws EncoderException
+    /* no qualifier */ ByteBuffer encodeInternal() throws EncoderException
     {
         // Allocate the bytes buffer.
-        ByteBuffer bb = ByteBuffer.allocate( computeLength() );
+        ByteBuffer bb = ByteBuffer.allocate( computeLengthInternal() );
 
         try
         {
@@ -301,7 +303,7 @@ public class StoredProcedureRequestDecor
         {
             try
             {
-                requestValue = encode().array();
+                requestValue = encodeInternal().array();
             }
             catch ( EncoderException e )
             {

Copied: directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/cancel/CancelRequestTest.java
(from r1578980, directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/CancelRequestTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/cancel/CancelRequestTest.java?p2=directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/cancel/CancelRequestTest.java&p1=directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/CancelRequestTest.java&r1=1578980&r2=1579895&rev=1579895&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/CancelRequestTest.java
(original)
+++ directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/cancel/CancelRequestTest.java
Fri Mar 21 07:28:08 2014
@@ -18,7 +18,7 @@
  *  
  */
 
-package org.apache.directory.api.ldap.extras.extended.ads_impl;
+package org.apache.directory.api.ldap.extras.extended.ads_impl.cancel;
 
 
 import static org.junit.Assert.assertEquals;
@@ -90,7 +90,7 @@ public class CancelRequestTest
         // Check the encoding
         try
         {
-            ByteBuffer bb = cancel.encode();
+            ByteBuffer bb = cancel.encodeInternal();
 
             String encodedPdu = Strings.dumpBytes( bb.array() );
 

Copied: directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/certGeneration/CertGenerationRequestTest.java
(from r1579091, directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/CertGenerationRequestTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/certGeneration/CertGenerationRequestTest.java?p2=directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/certGeneration/CertGenerationRequestTest.java&p1=directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/CertGenerationRequestTest.java&r1=1579091&r2=1579895&rev=1579895&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/CertGenerationRequestTest.java
(original)
+++ directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/certGeneration/CertGenerationRequestTest.java
Fri Mar 21 07:28:08 2014
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.api.ldap.extras.extended.ads_impl;
+package org.apache.directory.api.ldap.extras.extended.ads_impl.certGeneration;
 
 
 import static org.junit.Assert.assertEquals;
@@ -111,11 +111,11 @@ public class CertGenerationRequestTest
         assertEquals( dn, req.getSubjectDN() );
         assertEquals( keyAlgo, req.getKeyAlgorithm() );
 
-        assertEquals( bufLen, req.computeLength() );
+        assertEquals( bufLen, req.computeLengthInternal() );
 
         try
         {
-            ByteBuffer encodedBuf = req.encode();
+            ByteBuffer encodedBuf = req.encodeInternal();
             String encodedPdu = Strings.dumpBytes( encodedBuf.array() );
 
             assertEquals( decodedPdu, encodedPdu );

Copied: directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/gracefulDisconnect/GracefulDisconnectResponseTest.java
(from r1579743, directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/GracefulDisconnectResponseTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/gracefulDisconnect/GracefulDisconnectResponseTest.java?p2=directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/gracefulDisconnect/GracefulDisconnectResponseTest.java&p1=directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/GracefulDisconnectResponseTest.java&r1=1579743&r2=1579895&rev=1579895&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/GracefulDisconnectResponseTest.java
(original)
+++ directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/gracefulDisconnect/GracefulDisconnectResponseTest.java
Fri Mar 21 07:28:08 2014
@@ -17,7 +17,7 @@
  *  under the License.
  *
  */
-package org.apache.directory.api.ldap.extras.extended.ads_impl;
+package org.apache.directory.api.ldap.extras.extended.ads_impl.gracefulDisconnect;
 
 
 import static org.junit.Assert.assertEquals;
@@ -199,12 +199,12 @@ public class GracefulDisconnectResponseT
         assertEquals( "ldap://ldap.netscape.com/o=Babsco,c=US???(int=%5c00%5c00%5c00%5c04)",
ldapUrls.next() );
 
         // Check the length
-        assertEquals( 0x70, gracefulDisconnect.computeLength() );
+        assertEquals( 0x70, gracefulDisconnect.computeLengthInternal() );
 
         // Check the encoding
         try
         {
-            ByteBuffer bb = gracefulDisconnect.encode();
+            ByteBuffer bb = gracefulDisconnect.encodeInternal();
 
             String encodedPdu = Strings.dumpBytes( bb.array() );
 
@@ -254,12 +254,12 @@ public class GracefulDisconnectResponseT
         assertEquals( 0, gracefulDisconnect.getReplicatedContexts().getLdapUrls().size()
);
 
         // Check the length
-        assertEquals( 0x05, gracefulDisconnect.computeLength() );
+        assertEquals( 0x05, gracefulDisconnect.computeLengthInternal() );
 
         // Check the encoding
         try
         {
-            ByteBuffer bb1 = gracefulDisconnect.encode();
+            ByteBuffer bb1 = gracefulDisconnect.encodeInternal();
 
             String encodedPdu = Strings.dumpBytes( bb1.array() );
 
@@ -310,12 +310,12 @@ public class GracefulDisconnectResponseT
         assertEquals( 0, gracefulDisconnect.getReplicatedContexts().getLdapUrls().size()
);
 
         // Check the length
-        assertEquals( 0x05, gracefulDisconnect.computeLength() );
+        assertEquals( 0x05, gracefulDisconnect.computeLengthInternal() );
 
         // Check the encoding
         try
         {
-            ByteBuffer bb1 = gracefulDisconnect.encode();
+            ByteBuffer bb1 = gracefulDisconnect.encodeInternal();
 
             String encodedPdu = Strings.dumpBytes( bb1.array() );
 
@@ -369,12 +369,12 @@ public class GracefulDisconnectResponseT
         assertEquals( 0, gracefulDisconnect.getReplicatedContexts().getLdapUrls().size()
);
 
         // Check the length
-        assertEquals( 0x08, gracefulDisconnect.computeLength() );
+        assertEquals( 0x08, gracefulDisconnect.computeLengthInternal() );
 
         // Check the encoding
         try
         {
-            ByteBuffer bb2 = gracefulDisconnect.encode();
+            ByteBuffer bb2 = gracefulDisconnect.encodeInternal();
 
             String encodedPdu = Strings.dumpBytes( bb2.array() );
 
@@ -530,12 +530,12 @@ public class GracefulDisconnectResponseT
         assertEquals( "ldap://ldap.netscape.com/o=Babsco,c=US???(int=%5c00%5c00%5c00%5c04)",
ldapUrls.next() );
 
         // Check the length
-        assertEquals( 0x6A, gracefulDisconnect.computeLength() );
+        assertEquals( 0x6A, gracefulDisconnect.computeLengthInternal() );
 
         // Check the encoding
         try
         {
-            ByteBuffer bb = gracefulDisconnect.encode();
+            ByteBuffer bb = gracefulDisconnect.encodeInternal();
 
             String encodedPdu = Strings.dumpBytes( bb.array() );
 
@@ -582,12 +582,12 @@ public class GracefulDisconnectResponseT
         assertEquals( 0, gracefulDisconnect.getReplicatedContexts().getLdapUrls().size()
);
 
         // Check the length
-        assertEquals( 0x02, gracefulDisconnect.computeLength() );
+        assertEquals( 0x02, gracefulDisconnect.computeLengthInternal() );
 
         // Check the encoding
         try
         {
-            ByteBuffer bb1 = gracefulDisconnect.encode();
+            ByteBuffer bb1 = gracefulDisconnect.encodeInternal();
 
             String encodedPdu = Strings.dumpBytes( bb1.array() );
 

Copied: directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/gracefulShutdown/GracefulShutdownTest.java
(from r1579091, directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/GracefulShutdownTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/gracefulShutdown/GracefulShutdownTest.java?p2=directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/gracefulShutdown/GracefulShutdownTest.java&p1=directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/GracefulShutdownTest.java&r1=1579091&r2=1579895&rev=1579895&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/GracefulShutdownTest.java
(original)
+++ directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/gracefulShutdown/GracefulShutdownTest.java
Fri Mar 21 07:28:08 2014
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.api.ldap.extras.extended.ads_impl;
+package org.apache.directory.api.ldap.extras.extended.ads_impl.gracefulShutdown;
 
 
 import static org.junit.Assert.assertEquals;
@@ -88,12 +88,12 @@ public class GracefulShutdownTest
         assertEquals( 1, gracefulShutdownRequest.getDelay() );
 
         // Check the length
-        assertEquals( 0x08, gracefulShutdownRequest.computeLength() );
+        assertEquals( 0x08, gracefulShutdownRequest.computeLengthInternal() );
 
         // Check the encoding
         try
         {
-            ByteBuffer bb1 = gracefulShutdownRequest.encode();
+            ByteBuffer bb1 = gracefulShutdownRequest.encodeInternal();
 
             String encodedPdu = Strings.dumpBytes( bb1.array() );
 
@@ -142,12 +142,12 @@ public class GracefulShutdownTest
         assertEquals( 0, gracefulShutdownRequest.getDelay() );
 
         // Check the length
-        assertEquals( 0x05, gracefulShutdownRequest.computeLength() );
+        assertEquals( 0x05, gracefulShutdownRequest.computeLengthInternal() );
 
         // Check the encoding
         try
         {
-            ByteBuffer bb1 = gracefulShutdownRequest.encode();
+            ByteBuffer bb1 = gracefulShutdownRequest.encodeInternal();
 
             String encodedPdu = Strings.dumpBytes( bb1.array() );
 
@@ -197,12 +197,12 @@ public class GracefulShutdownTest
         assertEquals( 1, gracefulShutdownRequest.getDelay() );
 
         // Check the length
-        assertEquals( 0x05, gracefulShutdownRequest.computeLength() );
+        assertEquals( 0x05, gracefulShutdownRequest.computeLengthInternal() );
 
         // Check the encoding
         try
         {
-            ByteBuffer bb1 = gracefulShutdownRequest.encode();
+            ByteBuffer bb1 = gracefulShutdownRequest.encodeInternal();
 
             String encodedPdu = Strings.dumpBytes( bb1.array() );
 
@@ -248,12 +248,12 @@ public class GracefulShutdownTest
         assertEquals( 0, gracefulShutdownRequest.getDelay() );
 
         // Check the length
-        assertEquals( 0x02, gracefulShutdownRequest.computeLength() );
+        assertEquals( 0x02, gracefulShutdownRequest.computeLengthInternal() );
 
         // Check the encoding
         try
         {
-            ByteBuffer bb1 = gracefulShutdownRequest.encode();
+            ByteBuffer bb1 = gracefulShutdownRequest.encodeInternal();
 
             String encodedPdu = Strings.dumpBytes( bb1.array() );
 
@@ -305,12 +305,12 @@ public class GracefulShutdownTest
         assertEquals( 500, gracefulShutdownRequest.getDelay() );
 
         // Check the length
-        assertEquals( 0x06, gracefulShutdownRequest.computeLength() );
+        assertEquals( 0x06, gracefulShutdownRequest.computeLengthInternal() );
 
         // Check the encoding
         try
         {
-            ByteBuffer bb1 = gracefulShutdownRequest.encode();
+            ByteBuffer bb1 = gracefulShutdownRequest.encodeInternal();
 
             String encodedPdu = Strings.dumpBytes( bb1.array() );
 
@@ -362,12 +362,12 @@ public class GracefulShutdownTest
         assertEquals( 32767, gracefulShutdownRequest.getDelay() );
 
         // Check the length
-        assertEquals( 0x06, gracefulShutdownRequest.computeLength() );
+        assertEquals( 0x06, gracefulShutdownRequest.computeLengthInternal() );
 
         // Check the encoding
         try
         {
-            ByteBuffer bb1 = gracefulShutdownRequest.encode();
+            ByteBuffer bb1 = gracefulShutdownRequest.encodeInternal();
 
             String encodedPdu = Strings.dumpBytes( bb1.array() );
 
@@ -422,12 +422,12 @@ public class GracefulShutdownTest
         assertEquals( 32768, gracefulShutdownRequest.getDelay() );
 
         // Check the length
-        assertEquals( 0x07, gracefulShutdownRequest.computeLength() );
+        assertEquals( 0x07, gracefulShutdownRequest.computeLengthInternal() );
 
         // Check the encoding
         try
         {
-            ByteBuffer bb1 = gracefulShutdownRequest.encode();
+            ByteBuffer bb1 = gracefulShutdownRequest.encodeInternal();
 
             String encodedPdu = Strings.dumpBytes( bb1.array() );
 

Copied: directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/storedProcedure/StoredProcedureTest.java
(from r1578136, directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/StoredProcedureTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/storedProcedure/StoredProcedureTest.java?p2=directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/storedProcedure/StoredProcedureTest.java&p1=directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/StoredProcedureTest.java&r1=1578136&r2=1579895&rev=1579895&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/StoredProcedureTest.java
(original)
+++ directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/storedProcedure/StoredProcedureTest.java
Fri Mar 21 07:28:08 2014
@@ -18,7 +18,7 @@
  *  
  */
 
-package org.apache.directory.api.ldap.extras.extended.ads_impl;
+package org.apache.directory.api.ldap.extras.extended.ads_impl.storedProcedure;
 
 
 import static org.junit.Assert.assertEquals;
@@ -113,7 +113,7 @@ public class StoredProcedureTest
         // Check the encoding
         try
         {
-            ByteBuffer bb = storedProcedure.encode();
+            ByteBuffer bb = storedProcedure.encodeInternal();
             String encodedPdu = Strings.dumpBytes( bb.array() );
             assertEquals( encodedPdu, decodedPdu );
         }
@@ -168,7 +168,7 @@ public class StoredProcedureTest
         // Check the encoding
         try
         {
-            ByteBuffer bb = storedProcedure.encode();
+            ByteBuffer bb = storedProcedure.encodeInternal();
 
             String encodedPdu = Strings.dumpBytes( bb.array() );
 
@@ -231,7 +231,7 @@ public class StoredProcedureTest
         // Check the encoding
         try
         {
-            ByteBuffer bb = storedProcedure.encode();
+            ByteBuffer bb = storedProcedure.encodeInternal();
 
             String encodedPdu = Strings.dumpBytes( bb.array() );
 



Mime
View raw message