You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2011/01/31 20:48:36 UTC
svn commit: r1065728 - in
/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec:
./ controls/ controls/ppolicy/ controls/replication/syncDoneValue/
controls/replication/syncInfoValue/ controls/replication/syncRequestValue/
c...
Author: elecharny
Date: Mon Jan 31 19:48:35 2011
New Revision: 1065728
URL: http://svn.apache.org/viewvc?rev=1065728&view=rev
Log:
Fixed the way the conrols are encoded
Modified:
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/BasicControlDecorator.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapEncoder.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeDecorator.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlDecorator.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITDecorator.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyRequestDecorator.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseDecorator.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueDecorator.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueDecorator.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueDecorator.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueDecorator.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnDecorator.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeDecorator.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsDecorator.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchDecorator.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesDecorator.java
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/BasicControlDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/BasicControlDecorator.java?rev=1065728&r1=1065727&r2=1065728&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/BasicControlDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/BasicControlDecorator.java Mon Jan 31 19:48:35 2011
@@ -25,7 +25,6 @@ import java.nio.ByteBuffer;
import org.apache.directory.shared.asn1.Asn1Object;
import org.apache.directory.shared.asn1.DecoderException;
import org.apache.directory.shared.asn1.EncoderException;
-import org.apache.directory.shared.asn1.ber.tlv.Value;
import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.codec.controls.ControlDecorator;
import org.apache.directory.shared.ldap.model.message.controls.BasicControl;
@@ -77,7 +76,7 @@ public class BasicControlDecorator exten
valueLength = getValue().length;
}
- return super.computeLength( valueLength );
+ return valueLength;
}
@@ -91,12 +90,9 @@ public class BasicControlDecorator exten
throw new EncoderException( I18n.err( I18n.ERR_04023 ) );
}
- // Encode the Control envelop
- super.encode( buffer );
-
if ( valueLength != 0 )
{
- Value.encode( buffer, getValue() );
+ buffer.put( getValue() );
}
return buffer;
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapEncoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapEncoder.java?rev=1065728&r1=1065727&r2=1065728&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapEncoder.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapEncoder.java Mon Jan 31 19:48:35 2011
@@ -48,6 +48,69 @@ public class LdapEncoder
private ILdapCodecService codec = new DefaultLdapCodecService();
+
+ private int computeControlLength( Control control )
+ {
+ // First, compute the control's value length
+ int controlValueLength = ((ICodecControl)control).computeLength();
+
+ // Now, compute the envelop length
+ // The OID
+ int oidLengh = Strings.getBytesUtf8( control.getOid() ).length;
+ int controlLength = 1 + TLV.getNbBytes( oidLengh ) + oidLengh;
+
+ // The criticality, only if true
+ if ( control.isCritical() )
+ {
+ controlLength += 1 + 1 + 1; // Always 3 for a boolean
+ }
+
+ if ( controlValueLength != 0 )
+ {
+ controlLength += 1 + TLV.getNbBytes( controlValueLength ) + controlValueLength;
+ }
+
+ return controlLength;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ private ByteBuffer encodeControl( ByteBuffer buffer, Control control ) throws EncoderException
+ {
+ if ( buffer == null )
+ {
+ throw new EncoderException( I18n.err( I18n.ERR_04023 ) );
+ }
+
+ try
+ {
+ // The LdapMessage Sequence
+ buffer.put( UniversalTag.SEQUENCE.getValue() );
+
+ // The length has been calculated by the computeLength method
+ int controlLength = computeControlLength( control );
+ buffer.put( TLV.getBytes( controlLength ) );
+ }
+ catch ( BufferOverflowException boe )
+ {
+ throw new EncoderException( I18n.err( I18n.ERR_04005 ) );
+ }
+
+ // The control type
+ Value.encode( buffer, control.getOid().getBytes() );
+
+ // The control criticality, if true
+ if ( control.isCritical() )
+ {
+ Value.encode( buffer, control.isCritical() );
+ }
+
+ return buffer;
+ }
+
+
/**
* Generate the PDU which contains the encoded object.
*
@@ -106,12 +169,24 @@ public class LdapEncoder
{
// Encode the controls
buffer.put( ( byte ) LdapConstants.CONTROLS_TAG );
- buffer.put( TLV.getBytes(decorator.getControlsLength()) );
+ buffer.put( TLV.getBytes( decorator.getControlsLength() ) );
// Encode each control
for ( Control control : controls.values() )
{
- ( ( ICodecControl<?> ) control ).encode( buffer );
+ encodeControl( buffer, control );
+
+ // The OctetString tag if the value is not null
+ int controlValueLength = ((ICodecControl)control).computeLength();
+
+ if ( controlValueLength > 0 )
+ {
+ buffer.put( UniversalTag.OCTET_STRING.getValue() );
+ buffer.put( TLV.getBytes( controlValueLength ) );
+
+ // And now, the value
+ ( ( ICodecControl<?> ) control ).encode( buffer );
+ }
}
}
}
@@ -182,7 +257,9 @@ public class LdapEncoder
// We may have more than one control. ControlsLength is L4.
for ( Control control : controls.values() )
{
- controlsSequenceLength += ( ( ICodecControl<?> ) control ).computeLength();
+ int controlLength = computeControlLength( control );
+
+ controlsSequenceLength += 1 + TLV.getNbBytes( controlLength ) + controlLength;
}
// Computes the controls length
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeDecorator.java?rev=1065728&r1=1065727&r2=1065728&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeDecorator.java Mon Jan 31 19:48:35 2011
@@ -20,8 +20,11 @@
package org.apache.directory.shared.ldap.codec.controls;
+import java.nio.ByteBuffer;
+
import org.apache.directory.shared.asn1.Asn1Object;
import org.apache.directory.shared.asn1.DecoderException;
+import org.apache.directory.shared.asn1.EncoderException;
import org.apache.directory.shared.ldap.codec.ILdapCodecService;
import org.apache.directory.shared.ldap.model.message.controls.Cascade;
@@ -47,8 +50,7 @@ public class CascadeDecorator extends Co
*/
public int computeLength()
{
- // Call the super class to compute the global control length
- return super.computeLength( 0 );
+ return 0;
}
@@ -56,4 +58,11 @@ public class CascadeDecorator extends Co
{
return this;
}
+
+
+ @Override
+ public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
+ {
+ return buffer;
+ }
}
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlDecorator.java?rev=1065728&r1=1065727&r2=1065728&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlDecorator.java Mon Jan 31 19:48:35 2011
@@ -20,21 +20,15 @@
package org.apache.directory.shared.ldap.codec.controls;
-import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
import org.apache.directory.shared.asn1.AbstractAsn1Object;
import org.apache.directory.shared.asn1.Asn1Object;
import org.apache.directory.shared.asn1.DecoderException;
import org.apache.directory.shared.asn1.EncoderException;
-import org.apache.directory.shared.asn1.ber.tlv.TLV;
-import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
-import org.apache.directory.shared.asn1.ber.tlv.Value;
-import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.codec.ICodecControl;
import org.apache.directory.shared.ldap.codec.ILdapCodecService;
import org.apache.directory.shared.ldap.model.message.Control;
-import org.apache.directory.shared.util.Strings;
/**
@@ -58,7 +52,7 @@ public abstract class ControlDecorator<E
private int controlLength;
/** The encoded value of the control. */
- private byte[] value;
+ protected byte[] value;
/** The codec service responsible for encoding decoding this object */
private ILdapCodecService codec;
@@ -77,35 +71,6 @@ public abstract class ControlDecorator<E
/**
- * 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;
- }
-
-
- /**
* {@inheritDoc}
*/
public E getDecorated()
@@ -121,7 +86,7 @@ public abstract class ControlDecorator<E
{
this.decorated = decorated;
}
-
+
/**
* {@inheritDoc}
@@ -227,37 +192,7 @@ public abstract class ControlDecorator<E
/**
* {@inheritDoc}
*/
- public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
- {
- if ( buffer == null )
- {
- throw new EncoderException( I18n.err( I18n.ERR_04023 ) );
- }
-
- try
- {
- // The LdapMessage Sequence
- buffer.put( UniversalTag.SEQUENCE.getValue() );
-
- // The length has been calculated by the computeLength method
- buffer.put( TLV.getBytes( controlLength ) );
- }
- catch ( BufferOverflowException boe )
- {
- throw new EncoderException( I18n.err( I18n.ERR_04005 ) );
- }
-
- // The control type
- Value.encode( buffer, getOid().getBytes() );
-
- // The control criticality, if true
- if ( isCritical() )
- {
- Value.encode( buffer, isCritical() );
- }
-
- return buffer;
- }
+ public abstract ByteBuffer encode( ByteBuffer buffer ) throws EncoderException;
// ------------------------------------------------------------------------
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITDecorator.java?rev=1065728&r1=1065727&r2=1065728&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITDecorator.java Mon Jan 31 19:48:35 2011
@@ -20,8 +20,11 @@
package org.apache.directory.shared.ldap.codec.controls;
+import java.nio.ByteBuffer;
+
import org.apache.directory.shared.asn1.Asn1Object;
import org.apache.directory.shared.asn1.DecoderException;
+import org.apache.directory.shared.asn1.EncoderException;
import org.apache.directory.shared.ldap.codec.ILdapCodecService;
import org.apache.directory.shared.ldap.model.message.controls.ManageDsaIT;
@@ -49,8 +52,7 @@ public class ManageDsaITDecorator extend
*/
public int computeLength()
{
- // Call the super class to compute the global control length
- return super.computeLength( 0 );
+ return 0;
}
@@ -58,4 +60,11 @@ public class ManageDsaITDecorator extend
{
return this;
}
+
+
+ @Override
+ public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
+ {
+ return buffer;
+ }
}
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyRequestDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyRequestDecorator.java?rev=1065728&r1=1065727&r2=1065728&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyRequestDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyRequestDecorator.java Mon Jan 31 19:48:35 2011
@@ -20,8 +20,11 @@
package org.apache.directory.shared.ldap.codec.controls.ppolicy;
+import java.nio.ByteBuffer;
+
import org.apache.directory.shared.asn1.Asn1Object;
import org.apache.directory.shared.asn1.DecoderException;
+import org.apache.directory.shared.asn1.EncoderException;
import org.apache.directory.shared.ldap.codec.ILdapCodecService;
import org.apache.directory.shared.ldap.codec.controls.ControlDecorator;
@@ -51,4 +54,11 @@ public class PasswordPolicyRequestDecora
{
return this;
}
+
+
+ @Override
+ public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
+ {
+ return buffer;
+ }
}
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseDecorator.java?rev=1065728&r1=1065727&r2=1065728&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseDecorator.java Mon Jan 31 19:48:35 2011
@@ -22,13 +22,13 @@ package org.apache.directory.shared.ldap
import java.nio.ByteBuffer;
+import org.apache.directory.shared.asn1.Asn1Object;
+import org.apache.directory.shared.asn1.DecoderException;
+import org.apache.directory.shared.asn1.EncoderException;
import org.apache.directory.shared.asn1.ber.Asn1Decoder;
import org.apache.directory.shared.asn1.ber.tlv.TLV;
import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
import org.apache.directory.shared.asn1.ber.tlv.Value;
-import org.apache.directory.shared.asn1.Asn1Object;
-import org.apache.directory.shared.asn1.DecoderException;
-import org.apache.directory.shared.asn1.EncoderException;
import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.codec.ILdapCodecService;
import org.apache.directory.shared.ldap.codec.controls.ControlDecorator;
@@ -93,7 +93,7 @@ public class PasswordPolicyResponseDecor
valueLength = 1 + TLV.getNbBytes( ppolicySeqLength ) + ppolicySeqLength;
}
- return super.computeLength( valueLength );
+ return valueLength;
}
@@ -105,16 +105,6 @@ public class PasswordPolicyResponseDecor
throw new EncoderException( I18n.err( I18n.ERR_04023 ) );
}
- // Encode the Control envelop
- super.encode( buffer );
-
- if ( valueLength > 0 )
- {
- // Encode the OCTET_STRING tag
- buffer.put( UniversalTag.OCTET_STRING.getValue() );
- buffer.put( TLV.getBytes( valueLength ) );
- }
-
if ( ( getTimeBeforeExpiration() < 0 ) && ( getGraceAuthNsRemaining() < 0 ) && ( getPasswordPolicyError() == null ) )
{
return buffer;
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueDecorator.java?rev=1065728&r1=1065727&r2=1065728&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueDecorator.java Mon Jan 31 19:48:35 2011
@@ -46,8 +46,6 @@ public class SyncDoneValueDecorator exte
/** The global length for this control */
private int syncDoneValueLength;
- private byte[] value;
-
/** An instance of this decoder */
private static final Asn1Decoder decoder = new Asn1Decoder();
@@ -86,7 +84,7 @@ public class SyncDoneValueDecorator exte
valueLength = 1 + TLV.getNbBytes( syncDoneValueLength ) + syncDoneValueLength;
// Call the super class to compute the global control length
- return super.computeLength( valueLength );
+ return valueLength;
}
@@ -105,13 +103,6 @@ public class SyncDoneValueDecorator exte
throw new EncoderException( I18n.err( I18n.ERR_04023 ) );
}
- // Encode the Control envelop
- super.encode( buffer );
-
- // Encode the OCTET_STRING tag
- buffer.put( UniversalTag.OCTET_STRING.getValue() );
- buffer.put( TLV.getBytes( valueLength ) );
-
// Encode the SEQ
buffer.put( UniversalTag.SEQUENCE.getValue() );
buffer.put( TLV.getBytes( syncDoneValueLength ) );
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueDecorator.java?rev=1065728&r1=1065727&r2=1065728&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueDecorator.java Mon Jan 31 19:48:35 2011
@@ -49,8 +49,6 @@ public class SyncInfoValueDecorator exte
/** The syncUUIDs cumulative length */
private int syncUUIDsLength;
- private byte[] value;
-
/** An instance of this decoder */
private static final Asn1Decoder decoder = new Asn1Decoder();
@@ -195,8 +193,6 @@ public class SyncInfoValueDecorator exte
}
-
-
/**
* Compute the SyncInfoValue length.
*
@@ -246,7 +242,7 @@ public class SyncInfoValueDecorator exte
valueLength = syncInfoValueLength;
// Call the super class to compute the global control length
- return super.computeLength( valueLength );
+ return valueLength;
case REFRESH_DELETE :
case REFRESH_PRESENT :
@@ -264,7 +260,7 @@ public class SyncInfoValueDecorator exte
valueLength = 1 + TLV.getNbBytes( syncInfoValueLength ) + syncInfoValueLength;
// Call the super class to compute the global control length
- return super.computeLength( valueLength );
+ return valueLength;
case SYNC_ID_SET :
if ( getCookie() != null )
@@ -295,7 +291,10 @@ public class SyncInfoValueDecorator exte
valueLength = 1 + TLV.getNbBytes( syncInfoValueLength ) + syncInfoValueLength;
// Call the super class to compute the global control length
- return super.computeLength( valueLength );
+ return valueLength;
+
+ default :
+
}
return 1 + TLV.getNbBytes( syncInfoValueLength ) + syncInfoValueLength;
@@ -316,13 +315,6 @@ public class SyncInfoValueDecorator exte
throw new EncoderException( I18n.err( I18n.ERR_04023 ) );
}
- // Encode the Control envelop
- super.encode( buffer );
-
- // Encode the OCTET_STRING tag
- buffer.put( UniversalTag.OCTET_STRING.getValue() );
- buffer.put( TLV.getBytes( valueLength ) );
-
switch ( getType() )
{
case NEW_COOKIE :
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueDecorator.java?rev=1065728&r1=1065727&r2=1065728&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueDecorator.java Mon Jan 31 19:48:35 2011
@@ -47,9 +47,6 @@ public class SyncRequestValueDecorator
/** The global length for this control */
private int syncRequestValueLength;
- /** The opaque value of the control */
- private byte[] value;
-
/** An instance of this decoder */
private static final Asn1Decoder decoder = new Asn1Decoder();
@@ -161,7 +158,7 @@ public class SyncRequestValueDecorator
valueLength = 1 + TLV.getNbBytes( syncRequestValueLength ) + syncRequestValueLength;
// Call the super class to compute the global control length
- return super.computeLength( valueLength );
+ return valueLength;
}
@@ -179,13 +176,6 @@ public class SyncRequestValueDecorator
throw new EncoderException( I18n.err( I18n.ERR_04023 ) );
}
- // Encode the Control envelop
- super.encode( buffer );
-
- // Encode the OCTET_STRING tag
- buffer.put( UniversalTag.OCTET_STRING.getValue() );
- buffer.put( TLV.getBytes( valueLength ) );
-
// Encode the SEQ
buffer.put( UniversalTag.SEQUENCE.getValue() );
buffer.put( TLV.getBytes( syncRequestValueLength ) );
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueDecorator.java?rev=1065728&r1=1065727&r2=1065728&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueDecorator.java Mon Jan 31 19:48:35 2011
@@ -47,9 +47,6 @@ public class SyncStateValueDecorator ext
/** Global length for the control */
private int syncStateSeqLength;
- /** The opaque ASN.1 encoded value for this control */
- private byte[] value;
-
/** An instance of this decoder */
private static final Asn1Decoder decoder = new Asn1Decoder();
@@ -146,7 +143,7 @@ public class SyncStateValueDecorator ext
valueLength = 1 + TLV.getNbBytes( syncStateSeqLength ) + syncStateSeqLength;
- return super.computeLength( valueLength );
+ return valueLength;
}
@@ -164,13 +161,6 @@ public class SyncStateValueDecorator ext
throw new EncoderException( I18n.err( I18n.ERR_04023 ) );
}
- // Encode the Control envelop
- super.encode( buffer );
-
- // Encode the OCTET_STRING tag
- buffer.put( UniversalTag.OCTET_STRING.getValue() );
- buffer.put( TLV.getBytes( valueLength ) );
-
// Encode the SEQ
buffer.put( UniversalTag.SEQUENCE.getValue() );
buffer.put( TLV.getBytes( syncStateSeqLength ) );
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnDecorator.java?rev=1065728&r1=1065727&r2=1065728&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnDecorator.java Mon Jan 31 19:48:35 2011
@@ -70,8 +70,6 @@ public class SyncModifyDnDecorator exten
private int renameLen = 0;
private int moveAndRenameLen = 0;
- private byte[] value;
-
/** An instance of this decoder */
private Asn1Decoder decoder = new Asn1Decoder();
@@ -133,7 +131,7 @@ public class SyncModifyDnDecorator exten
valueLength = 1 + TLV.getNbBytes( syncModDnSeqLength ) + syncModDnSeqLength;
- return super.computeLength( valueLength );
+ return valueLength;
}
@@ -151,13 +149,6 @@ public class SyncModifyDnDecorator exten
throw new EncoderException( I18n.err( I18n.ERR_04023 ) );
}
- // Encode the Control envelop
- super.encode( buffer );
-
- // Encode the OCTET_STRING tag
- buffer.put( UniversalTag.OCTET_STRING.getValue() );
- buffer.put( TLV.getBytes( valueLength ) );
-
// Encode the SEQ
buffer.put( UniversalTag.SEQUENCE.getValue() );
buffer.put( TLV.getBytes( syncModDnSeqLength ) );
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeDecorator.java?rev=1065728&r1=1065727&r2=1065728&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeDecorator.java Mon Jan 31 19:48:35 2011
@@ -57,9 +57,6 @@ public class EntryChangeDecorator extend
/** The entry change global length */
private int eccSeqLength;
- /** The encoded value of the control. */
- private byte[] value;
-
/** An instance of this decoder */
private static final Asn1Decoder decoder = new Asn1Decoder();
@@ -127,8 +124,7 @@ public class EntryChangeDecorator extend
eccSeqLength = changeTypesLength + previousDnLength + changeNumberLength;
valueLength = 1 + TLV.getNbBytes( eccSeqLength ) + eccSeqLength;
- // Call the super class to compute the global control length
- return super.computeLength( valueLength );
+ return valueLength;
}
@@ -146,13 +142,6 @@ public class EntryChangeDecorator extend
throw new EncoderException( I18n.err( I18n.ERR_04023 ) );
}
- // Encode the Control envelop
- super.encode( buffer );
-
- // Encode the OCTET_STRING tag
- buffer.put( UniversalTag.OCTET_STRING.getValue() );
- buffer.put( TLV.getBytes( valueLength ) );
-
buffer.put( UniversalTag.SEQUENCE.getValue() );
buffer.put( TLV.getBytes( eccSeqLength ) );
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsDecorator.java?rev=1065728&r1=1065727&r2=1065728&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsDecorator.java Mon Jan 31 19:48:35 2011
@@ -48,9 +48,6 @@ public class PagedResultsDecorator exten
/** The entry change global length */
private int pscSeqLength;
- /** The encoded value of the control. */
- private byte[] value;
-
/** An instance of this decoder */
private static final Asn1Decoder decoder = new Asn1Decoder();
@@ -108,8 +105,7 @@ public class PagedResultsDecorator exten
pscSeqLength = sizeLength + cookieLength;
valueLength = 1 + TLV.getNbBytes( pscSeqLength ) + pscSeqLength;
- // Call the super class to compute the global control length
- return super.computeLength( valueLength );
+ return valueLength;
}
@@ -127,13 +123,6 @@ public class PagedResultsDecorator exten
throw new EncoderException( I18n.err( I18n.ERR_04023 ) );
}
- // Encode the Control envelop
- super.encode( buffer );
-
- // Encode the OCTET_STRING tag
- buffer.put( UniversalTag.OCTET_STRING.getValue() );
- buffer.put( TLV.getBytes( valueLength ) );
-
// Now encode the PagedSearch specific part
buffer.put( UniversalTag.SEQUENCE.getValue() );
buffer.put( TLV.getBytes( pscSeqLength ) );
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchDecorator.java?rev=1065728&r1=1065727&r2=1065728&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchDecorator.java Mon Jan 31 19:48:35 2011
@@ -47,9 +47,6 @@ public class PersistentSearchDecorator e
/** A temporary storage for a psearch length */
private int psearchSeqLength;
- /** The encoded value of the control. */
- private byte[] value;
-
/** An instance of this decoder */
private static final Asn1Decoder decoder = new Asn1Decoder();
@@ -99,8 +96,7 @@ public class PersistentSearchDecorator e
psearchSeqLength = changeTypesLength + changesOnlyLength + returnRCsLength;
int valueLength = 1 + TLV.getNbBytes( psearchSeqLength ) + psearchSeqLength;
- // Call the super class to compute the global control length
- return super.computeLength( valueLength );
+ return valueLength;
}
@@ -118,13 +114,6 @@ public class PersistentSearchDecorator e
throw new EncoderException( I18n.err( I18n.ERR_04023 ) );
}
- // Encode the Control envelop
- super.encode( buffer );
-
- // Encode the OCTET_STRING tag
- buffer.put( UniversalTag.OCTET_STRING.getValue() );
- buffer.put( TLV.getBytes( valueLength ) );
-
// Now encode the PagedSearch specific part
buffer.put( UniversalTag.SEQUENCE.getValue() );
buffer.put( TLV.getBytes( psearchSeqLength ) );
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesDecorator.java?rev=1065728&r1=1065727&r2=1065728&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesDecorator.java Mon Jan 31 19:48:35 2011
@@ -26,8 +26,6 @@ import org.apache.directory.shared.asn1.
import org.apache.directory.shared.asn1.DecoderException;
import org.apache.directory.shared.asn1.EncoderException;
import org.apache.directory.shared.asn1.ber.Asn1Decoder;
-import org.apache.directory.shared.asn1.ber.tlv.TLV;
-import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
import org.apache.directory.shared.asn1.ber.tlv.Value;
import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.codec.ILdapCodecService;
@@ -44,9 +42,6 @@ import org.apache.directory.shared.ldap.
*/
public class SubentriesDecorator extends ControlDecorator<Subentries> implements Subentries
{
- /** The encoded value of the control. */
- private byte[] value;
-
/** The sub entry decoder */
private static final Asn1Decoder decoder = new Asn1Decoder();
@@ -77,11 +72,7 @@ public class SubentriesDecorator extends
*/
public int computeLength()
{
- int subentriesLength = 1 + 1 + 1;
- int valueLength = subentriesLength;
-
- // Call the super class to compute the global control length
- return super.computeLength( valueLength );
+ return 1 + 1 + 1;
}
@@ -99,13 +90,6 @@ public class SubentriesDecorator extends
throw new EncoderException( I18n.err( I18n.ERR_04023 ) );
}
- // Encode the Control envelop
- super.encode( buffer );
-
- // Encode the OCTET_STRING tag
- buffer.put( UniversalTag.OCTET_STRING.getValue() );
- buffer.put( TLV.getBytes( valueLength ) );
-
// Now encode the Subentries specific part
Value.encode( buffer, isVisible() );