directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r1063566 - in /directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls: AbstractControl.java CodecControlDecorator.java ManageDsaITControl.java
Date Wed, 26 Jan 2011 02:00:51 GMT
Author: akarasulu
Date: Wed Jan 26 02:00:51 2011
New Revision: 1063566

URL: http://svn.apache.org/viewvc?rev=1063566&view=rev
Log:
minor cleanups to get rid of IDEA warnings

Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/AbstractControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CodecControlDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITControl.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/AbstractControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/AbstractControl.java?rev=1063566&r1=1063565&r2=1063566&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/AbstractControl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/AbstractControl.java
Wed Jan 26 02:00:51 2011
@@ -141,7 +141,10 @@ public abstract class AbstractControl ex
 
 
     /**
-     * {@inheritDoc}
+     * Computes the length of the Control given the length of its value.
+     *
+     * @param valueLength The length of the Control's value.
+     * @return The length of the Control including its value.
      */
     public int computeLength( int valueLength )
     {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CodecControlDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CodecControlDecorator.java?rev=1063566&r1=1063565&r2=1063566&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CodecControlDecorator.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CodecControlDecorator.java
Wed Jan 26 02:00:51 2011
@@ -34,8 +34,9 @@ import java.nio.ByteBuffer;
 
 
 /**
- * Decorates Control objects enabling the codec to store transient information
- * with the object.
+ * Decorates Control objects by wrapping them, and enabling them as CodecControls
+ * so the codec to store transient information associated with the Control in the
+ * decorator while processing.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
@@ -66,6 +67,53 @@ public class CodecControlDecorator exten
 
 
     /**
+     * Creates a ControlDecorator to codec enable it.
+     *
+     * @param decoratedControl The Control to decorate.
+     * @param decoder The Control's decoder.
+     */
+    public CodecControlDecorator( Control decoratedControl, ControlDecoder decoder )
+    {
+        this.decoratedComponent = decoratedControl;
+        this.decoder = decoder;
+    }
+
+
+    /**
+     * Computes the length of the Control given the length of its value.
+     *
+     * @param valueLength The length of the Control's value.
+     * @return The length of the Control including its value.
+     */
+    public int computeLength( int valueLength )
+    {
+        // The OID
+        int oidLengh = Strings.getBytesUtf8( getOid() ).length;
+        controlLength = 1 + TLV.getNbBytes( oidLengh ) + oidLengh;
+
+        // The criticality, only if true
+        if ( isCritical() )
+        {
+            controlLength += 1 + 1 + 1; // Always 3 for a boolean
+        }
+
+        this.valueLength = valueLength;
+
+        if ( valueLength != 0 )
+        {
+            controlLength += 1 + TLV.getNbBytes( valueLength ) + valueLength;
+        }
+
+        return 1 + TLV.getNbBytes( controlLength ) + controlLength;
+    }
+
+
+    // ------------------------------------------------------------------------
+    // Control Methods
+    // ------------------------------------------------------------------------
+
+
+    /**
      * Get the OID
      * 
      * @return A string which represent the control oid
@@ -77,6 +125,15 @@ public class CodecControlDecorator exten
 
 
     /**
+     * {@inheritDoc}
+     */
+    public boolean hasValue()
+    {
+        return decoratedComponent.hasValue();
+    }
+
+
+    /**
      * Get the control value
      * 
      * @return The control value
@@ -129,38 +186,17 @@ public class CodecControlDecorator exten
     }
 
     
-    /**
-     * {@inheritDoc}
-     */
-    public int computeLength()
-    {
-        return 0;
-    }
+    // ------------------------------------------------------------------------
+    // CodecControl Methods
+    // ------------------------------------------------------------------------
 
 
     /**
      * {@inheritDoc}
      */
-    public int computeLength( int valueLength )
+    public int computeLength()
     {
-        // The OID
-        int oidLengh = Strings.getBytesUtf8( getOid() ).length;
-        controlLength = 1 + TLV.getNbBytes( oidLengh ) + oidLengh;
-
-        // The criticality, only if true
-        if ( isCritical() )
-        {
-            controlLength += 1 + 1 + 1; // Always 3 for a boolean
-        }
-
-        this.valueLength = valueLength;
-        
-        if ( valueLength != 0 )
-        {
-            controlLength += 1 + TLV.getNbBytes( valueLength ) + valueLength;
-        }
-        
-        return 1 + TLV.getNbBytes( controlLength ) + controlLength;
+        return 0;
     }
 
 
@@ -198,17 +234,8 @@ public class CodecControlDecorator exten
 
         return buffer;
     }
-    
-    
-    /**
-     * {@inheritDoc}
-     */
-    public boolean hasValue()
-    {
-        return decoratedComponent.hasValue();
-    }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -216,8 +243,13 @@ public class CodecControlDecorator exten
     {
         return decoder;
     }
-    
-    
+
+
+    // ------------------------------------------------------------------------
+    // Object Method Overrides
+    // ------------------------------------------------------------------------
+
+
     /**
      * @see Object#equals(Object)
      */

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITControl.java?rev=1063566&r1=1063565&r2=1063566&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITControl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITControl.java
Wed Jan 26 02:00:51 2011
@@ -59,7 +59,7 @@ package org.apache.directory.shared.ldap
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ManageDsaITControl  extends AbstractControl
+public class ManageDsaITControl extends AbstractControl
 {
     /** This control OID */
     public static final String CONTROL_OID = "2.16.840.1.113730.3.4.2";



Mime
View raw message