Class EntryChangeDecorator
- java.lang.Object
-
- org.apache.directory.api.ldap.codec.api.ControlDecorator<EntryChange>
-
- 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
Fields Modifier and Type Field Description static int
UNDEFINED_CHANGE_NUMBER
Default value when no change number is provided-
Fields inherited from interface org.apache.directory.api.ldap.model.message.controls.EntryChange
OID
-
-
Constructor Summary
Constructors Constructor Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
computeLength()
Compute the EntryChangeControl lengthAsn1Object
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 valuevoid
setChangeNumber(long changeNumber)
Sets the ChangeNumbervoid
setChangeType(ChangeType changeType)
Set the ChangeTypevoid
setPreviousDn(Dn previousDn)
Sets the previous DN-
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 interface org.apache.directory.api.ldap.model.message.Control
getOid, isCritical, setCritical
-
-
-
-
Field Detail
-
UNDEFINED_CHANGE_NUMBER
public static final int UNDEFINED_CHANGE_NUMBER
Default value when no change number is provided- 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.- Parameters:
codec
- The LDAP service instance
-
EntryChangeDecorator
public EntryChangeDecorator(LdapApiService codec, EntryChange control)
Creates a new instance of EntryChangeDecorator wrapping the supplied EntryChange Control.- Parameters:
codec
- The LDAP service instancecontrol
- The EntryChange Control to be decorated.
-
-
Method Detail
-
computeLength
public int computeLength()
Compute the EntryChangeControl length0x30 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 interfaceAsn1Object
- Returns:
- the control length.
-
encode
public ByteBuffer encode(ByteBuffer buffer) throws EncoderException
Encodes the entry change control.- Specified by:
encode
in interfaceAsn1Object
- 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 interfaceCodecControl<EntryChange>
- Overrides:
getValue
in classControlDecorator<EntryChange>
- Returns:
- The control value
-
getChangeType
public ChangeType getChangeType()
- Specified by:
getChangeType
in interfaceEntryChange
- Returns:
- The ChangeType
-
setChangeType
public void setChangeType(ChangeType changeType)
Set the ChangeType- Specified by:
setChangeType
in interfaceEntryChange
- Parameters:
changeType
- Add, Delete; Modify or ModifyDN
-
getPreviousDn
public Dn getPreviousDn()
- Specified by:
getPreviousDn
in interfaceEntryChange
- Returns:
- The previous DN
-
setPreviousDn
public void setPreviousDn(Dn previousDn)
Sets the previous DN- Specified by:
setPreviousDn
in interfaceEntryChange
- Parameters:
previousDn
- The previous DN
-
getChangeNumber
public long getChangeNumber()
- Specified by:
getChangeNumber
in interfaceEntryChange
- Returns:
- The change number
-
setChangeNumber
public void setChangeNumber(long changeNumber)
Sets the ChangeNumber- Specified by:
setChangeNumber
in interfaceEntryChange
- Parameters:
changeNumber
- The ChanegNumber
-
decode
public Asn1Object decode(byte[] controlBytes) throws DecoderException
Decodes raw ASN.1 encoded bytes into an Asn1Object for the control.- Specified by:
decode
in interfaceCodecControl<EntryChange>
- Parameters:
controlBytes
- the encoded control bytes- Returns:
- the decoded Asn1Object for the control
- Throws:
DecoderException
- if anything goes wrong
-
-