org.apache.directory.shared.ldap.extras.controls.syncrepl_impl
Class SyncDoneValueDecorator

java.lang.Object
  extended by org.apache.directory.shared.asn1.AbstractAsn1Object
      extended by org.apache.directory.shared.ldap.codec.controls.ControlDecorator<SyncDoneValue>
          extended by org.apache.directory.shared.ldap.extras.controls.syncrepl_impl.SyncDoneValueDecorator
All Implemented Interfaces:
Asn1Object, CodecControl<SyncDoneValue>, Decorator<SyncDoneValue>, SyncDoneValue, Control

public class SyncDoneValueDecorator
extends ControlDecorator<SyncDoneValue>
implements SyncDoneValue

A syncDoneValue object as described in rfc4533.

Author:
Apache Directory Project

Field Summary
 
Fields inherited from class org.apache.directory.shared.ldap.codec.controls.ControlDecorator
value, valueLength
 
Fields inherited from interface org.apache.directory.shared.ldap.extras.controls.SyncDoneValue
OID
 
Constructor Summary
SyncDoneValueDecorator(LdapCodecService codec)
          Creates a new instance of SyncDoneValueControlCodec.
SyncDoneValueDecorator(LdapCodecService codec, SyncDoneValue control)
          Creates a new instance of SyncDoneValueDecorator.
 
Method Summary
 int computeLength()
          Compute the syncDoneValue length.
 Asn1Object decode(byte[] controlBytes)
          Decodes raw ASN.1 encoded bytes into an Asn1Object for the control.
 ByteBuffer encode(ByteBuffer buffer)
          Encode the SyncDoneValue control
 byte[] getCookie()
          
 byte[] getValue()
          Get the control value
 boolean isRefreshDeletes()
          
 void setCookie(byte[] cookie)
          
 void setRefreshDeletes(boolean refreshDeletes)
          
 
Methods inherited from class org.apache.directory.shared.ldap.codec.controls.ControlDecorator
equals, getCodecService, getDecorated, getOid, hashCode, hasValue, isCritical, setCritical, setDecorated, setValue, toString
 
Methods inherited from class org.apache.directory.shared.asn1.AbstractAsn1Object
addLength, getCurrentLength, getExpectedLength, getParent, getTlvId, setCurrentLength, setExpectedLength, setParent
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.directory.shared.ldap.model.message.Control
getOid, isCritical, setCritical
 

Constructor Detail

SyncDoneValueDecorator

public SyncDoneValueDecorator(LdapCodecService codec)
Creates a new instance of SyncDoneValueControlCodec.


SyncDoneValueDecorator

public SyncDoneValueDecorator(LdapCodecService codec,
                              SyncDoneValue control)
Creates a new instance of SyncDoneValueDecorator.

Parameters:
codec - The LDAP codec
control - The control to be decorated
Method Detail

computeLength

public int computeLength()
Compute the syncDoneValue length. 0x30 L1 | +--> 0x04 L2 xkcd!!!... (cookie) +--> 0x01 0x01 [0x00|0xFF] (refreshDeletes)

Specified by:
computeLength in interface Asn1Object
Specified by:
computeLength in interface Decorator<SyncDoneValue>
Overrides:
computeLength in class ControlDecorator<SyncDoneValue>
Returns:
The object's computed length

encode

public ByteBuffer encode(ByteBuffer buffer)
                  throws EncoderException
Encode the SyncDoneValue control

Specified by:
encode in interface Asn1Object
Specified by:
encode in interface Decorator<SyncDoneValue>
Overrides:
encode in class AbstractAsn1Object
Parameters:
buffer - The encoded sink
Returns:
A ByteBuffer that contains the encoded PDU
Throws:
EncoderException - If anything goes wrong while encoding.

getValue

public byte[] getValue()
Get the control value

Specified by:
getValue in interface CodecControl<SyncDoneValue>
Overrides:
getValue in class ControlDecorator<SyncDoneValue>
Returns:
The control value

getCookie

public byte[] getCookie()

Specified by:
getCookie in interface SyncDoneValue
Returns:
the cookie

setCookie

public void setCookie(byte[] cookie)

Specified by:
setCookie in interface SyncDoneValue
Parameters:
cookie - cookie to be set

isRefreshDeletes

public boolean isRefreshDeletes()

Specified by:
isRefreshDeletes in interface SyncDoneValue
Returns:
true, if refreshDeletes flag is set, false otherwise

setRefreshDeletes

public void setRefreshDeletes(boolean refreshDeletes)

Specified by:
setRefreshDeletes in interface SyncDoneValue
Parameters:
refreshDeletes - set the refreshDeletes flag

decode

public Asn1Object decode(byte[] controlBytes)
                  throws DecoderException
Decodes raw ASN.1 encoded bytes into an Asn1Object for the control.

Specified by:
decode in interface CodecControl<SyncDoneValue>
Parameters:
controlBytes - the encoded control bytes
Returns:
the decoded Asn1Object for the control
Throws:
DecoderException - if anything goes wrong


Copyright © 2003-2011 The Apache Software Foundation. All Rights Reserved.