org.apache.directory.api.ldap.codec.controls.search.entryChange
Class EntryChangeDecorator

java.lang.Object
  extended by org.apache.directory.api.asn1.AbstractAsn1Object
      extended by org.apache.directory.api.ldap.codec.api.ControlDecorator<EntryChange>
          extended by org.apache.directory.api.ldap.codec.controls.search.entryChange.EntryChangeDecorator
All Implemented Interfaces:
Asn1Object, CodecControl<EntryChange>, Decorator<EntryChange>, Control, EntryChange

public class EntryChangeDecorator
extends ControlDecorator<EntryChange>
implements EntryChange

An EntryChange implementation, that wraps and decorates the Control with codec specific functionality.

Author:
Apache Directory Project

Field Summary
static int UNDEFINED_CHANGE_NUMBER
           
 
Fields inherited from class org.apache.directory.api.ldap.codec.api.ControlDecorator
value, valueLength
 
Fields inherited from interface org.apache.directory.api.ldap.model.message.controls.EntryChange
OID
 
Constructor Summary
EntryChangeDecorator(LdapApiService codec)
          Creates a new instance of EntryChangeDecoder wrapping a newly created EntryChange Control object.
EntryChangeDecorator(LdapApiService codec, EntryChange control)
          Creates a new instance of EntryChangeDecorator wrapping the supplied EntryChange Control.
 
Method Summary
 int computeLength()
          Compute the EntryChangeControl length 0x30 L1 | +--> 0x0A 0x0(1-4) [1|2|4|8] (changeType) [+--> 0x04 L2 previousDN] [+--> 0x02 0x0(1-4) [0..2^63-1] (changeNumber)]
 Asn1Object decode(byte[] controlBytes)
          Decodes raw ASN.1 encoded bytes into an Asn1Object for the control.
 ByteBuffer encode(ByteBuffer buffer)
          Encodes the entry change control.
 long getChangeNumber()
          
 ChangeType getChangeType()
          
 Dn getPreviousDn()
          
 byte[] getValue()
          Get the control value
 void setChangeNumber(long changeNumber)
          
 void setChangeType(ChangeType changeType)
          Set the ChangeType
 void setPreviousDn(Dn previousDn)
          
 
Methods inherited from class org.apache.directory.api.ldap.codec.api.ControlDecorator
equals, getCodecService, getDecorated, getOid, hashCode, hasValue, isCritical, setCritical, setDecorated, setValue, toString
 
Methods inherited from class org.apache.directory.api.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.api.ldap.model.message.Control
getOid, isCritical, setCritical
 

Field Detail

UNDEFINED_CHANGE_NUMBER

public static final int UNDEFINED_CHANGE_NUMBER
See Also:
Constant Field Values
Constructor Detail

EntryChangeDecorator

public EntryChangeDecorator(LdapApiService codec)
Creates a new instance of EntryChangeDecoder wrapping a newly created EntryChange Control object.


EntryChangeDecorator

public EntryChangeDecorator(LdapApiService codec,
                            EntryChange control)
Creates a new instance of EntryChangeDecorator wrapping the supplied EntryChange Control.

Parameters:
control - The EntryChange Control to be decorated.
Method Detail

computeLength

public int computeLength()
Compute the EntryChangeControl length 0x30 L1 | +--> 0x0A 0x0(1-4) [1|2|4|8] (changeType) [+--> 0x04 L2 previousDN] [+--> 0x02 0x0(1-4) [0..2^63-1] (changeNumber)]

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

encode

public ByteBuffer encode(ByteBuffer buffer)
                  throws EncoderException
Encodes the entry change control.

Specified by:
encode in interface Asn1Object
Specified by:
encode in interface Decorator<EntryChange>
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<EntryChange>
Overrides:
getValue in class ControlDecorator<EntryChange>
Returns:
The control value

getChangeType

public ChangeType getChangeType()

Specified by:
getChangeType in interface EntryChange
Returns:
The ChangeType

setChangeType

public void setChangeType(ChangeType changeType)
Set the ChangeType

Specified by:
setChangeType in interface EntryChange
Parameters:
changeType - Add, Delete; Modify or ModifyDN

getPreviousDn

public Dn getPreviousDn()

Specified by:
getPreviousDn in interface EntryChange

setPreviousDn

public void setPreviousDn(Dn previousDn)

Specified by:
setPreviousDn in interface EntryChange

getChangeNumber

public long getChangeNumber()

Specified by:
getChangeNumber in interface EntryChange

setChangeNumber

public void setChangeNumber(long changeNumber)

Specified by:
setChangeNumber in interface EntryChange

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<EntryChange>
Parameters:
controlBytes - the encoded control bytes
Returns:
the decoded Asn1Object for the control
Throws:
DecoderException - if anything goes wrong


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