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

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

public class SyncInfoValueDecorator
extends ControlDecorator<SyncInfoValue>
implements SyncInfoValue

A syncInfoValue object, as defined in RFC 4533

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.SyncInfoValue
OID
 
Constructor Summary
SyncInfoValueDecorator(LdapCodecService codec)
          The constructor for this codec.
SyncInfoValueDecorator(LdapCodecService codec, SynchronizationInfoEnum type)
          The constructor for this codec.
SyncInfoValueDecorator(LdapCodecService codec, SyncInfoValue control)
          The constructor for this codec.
 
Method Summary
 void addSyncUUID(byte[] syncUUID)
          
 int computeLength()
          Compute the SyncInfoValue length.
 Asn1Object decode(byte[] controlBytes)
          Decodes raw ASN.1 encoded bytes into an Asn1Object for the control.
 ByteBuffer encode(ByteBuffer buffer)
          Encode the SyncInfoValue control
 byte[] getCookie()
          
 List<byte[]> getSyncUUIDs()
          
 SynchronizationInfoEnum getType()
          Get the control type.
 byte[] getValue()
          Get the control value
 boolean isRefreshDeletes()
          
 boolean isRefreshDone()
          
 void setCookie(byte[] cookie)
          
 void setRefreshDeletes(boolean refreshDeletes)
          
 void setRefreshDone(boolean refreshDone)
          
 void setSyncUUIDs(List<byte[]> syncUUIDs)
          
 void setType(SynchronizationInfoEnum type)
          
 
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

SyncInfoValueDecorator

public SyncInfoValueDecorator(LdapCodecService codec)
The constructor for this codec. Dont't forget to set the type.


SyncInfoValueDecorator

public SyncInfoValueDecorator(LdapCodecService codec,
                              SyncInfoValue control)
The constructor for this codec. Dont't forget to set the type.


SyncInfoValueDecorator

public SyncInfoValueDecorator(LdapCodecService codec,
                              SynchronizationInfoEnum type)
The constructor for this codec.

Parameters:
type - The kind of syncInfo we will store. Can be newCookie, refreshPresent, refreshDelete or syncIdSet
Method Detail

getType

public SynchronizationInfoEnum getType()
Get the control type.

Specified by:
getType in interface SyncInfoValue
Returns:
the type : one of newCookie, refreshDelete, refreshPresent or syncIdSet

setType

public void setType(SynchronizationInfoEnum type)

Specified by:
setType in interface SyncInfoValue

getCookie

public byte[] getCookie()

Specified by:
getCookie in interface SyncInfoValue
Returns:
the cookie

setCookie

public void setCookie(byte[] cookie)

Specified by:
setCookie in interface SyncInfoValue
Parameters:
cookie - the cookie to set

isRefreshDone

public boolean isRefreshDone()

Specified by:
isRefreshDone in interface SyncInfoValue
Returns:
the refreshDone

setRefreshDone

public void setRefreshDone(boolean refreshDone)

Specified by:
setRefreshDone in interface SyncInfoValue
Parameters:
refreshDone - the refreshDone to set

isRefreshDeletes

public boolean isRefreshDeletes()

Specified by:
isRefreshDeletes in interface SyncInfoValue
Returns:
the refreshDeletes

setRefreshDeletes

public void setRefreshDeletes(boolean refreshDeletes)

Specified by:
setRefreshDeletes in interface SyncInfoValue
Parameters:
refreshDeletes - the refreshDeletes to set

getSyncUUIDs

public List<byte[]> getSyncUUIDs()

Specified by:
getSyncUUIDs in interface SyncInfoValue
Returns:
the syncUUIDs

setSyncUUIDs

public void setSyncUUIDs(List<byte[]> syncUUIDs)

Specified by:
setSyncUUIDs in interface SyncInfoValue
Parameters:
syncUUIDs - the syncUUIDs to set

addSyncUUID

public void addSyncUUID(byte[] syncUUID)

Specified by:
addSyncUUID in interface SyncInfoValue

computeLength

public int computeLength()
Compute the SyncInfoValue length. SyncInfoValue : 0xA0 L1 abcd // newCookie 0xA1 L2 // refreshDelete | [+--> 0x04 L3 abcd] // cookie [+--> 0x01 0x01 (0x00|0xFF) // refreshDone 0xA2 L4 // refreshPresent | [+--> 0x04 L5 abcd] // cookie [+--> 0x01 0x01 (0x00|0xFF) // refreshDone 0xA3 L6 // syncIdSet | [+--> 0x04 L7 abcd] // cookie [+--> 0x01 0x01 (0x00|0xFF) // refreshDeletes +--> 0x31 L8 // SET OF syncUUIDs | [+--> 0x04 L9 abcd] // syncUUID public static final int AND_FILTER_TAG = 0xA0; public static final int OR_FILTER_TAG = 0xA1; public static final int NOT_FILTER_TAG = 0xA2; public static final int BIND_REQUEST_SASL_TAG = 0xA3;

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

encode

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

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

getValue

public byte[] getValue()
Get the control value

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

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<SyncInfoValue>
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.