org.apache.directory.shared.ldap.codec.controls.search.persistentSearch
Class PersistentSearchDecorator

java.lang.Object
  extended by org.apache.directory.shared.asn1.AbstractAsn1Object
      extended by org.apache.directory.shared.ldap.codec.controls.ControlDecorator<PersistentSearch>
          extended by org.apache.directory.shared.ldap.codec.controls.search.persistentSearch.PersistentSearchDecorator
All Implemented Interfaces:
Asn1Object, CodecControl<PersistentSearch>, Decorator<PersistentSearch>, Control, PersistentSearch

public class PersistentSearchDecorator
extends ControlDecorator<PersistentSearch>
implements PersistentSearch

A persistence search object

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.model.message.controls.PersistentSearch
CHANGE_TYPES_MAX, CHANGE_TYPES_MIN, OID
 
Constructor Summary
PersistentSearchDecorator(LdapCodecService codec)
          Default constructor creates a PersistentSearch Control automatically wrapped in a decorator object inside this container.
PersistentSearchDecorator(LdapCodecService codec, PersistentSearch control)
          Creates a PersistentSearch Control wrapping a supplied PersistentSearch Control.
 
Method Summary
 int computeLength()
          Compute the PagedSearchControl length, which is the sum of the control length and the value length.
 Asn1Object decode(byte[] controlBytes)
          Decodes raw ASN.1 encoded bytes into an Asn1Object for the control.
 void enableNotification(ChangeType changeType)
           
 ByteBuffer encode(ByteBuffer buffer)
          Encodes the persistent search control.
 int getChangeTypes()
           
 byte[] getValue()
          Get the control value
 boolean isChangesOnly()
           
 boolean isNotificationEnabled(ChangeType changeType)
           
 boolean isReturnECs()
           
 void setChangesOnly(boolean changesOnly)
           
 void setChangeTypes(int changeTypes)
           
 void setReturnECs(boolean returnECs)
           
 
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

PersistentSearchDecorator

public PersistentSearchDecorator(LdapCodecService codec)
Default constructor creates a PersistentSearch Control automatically wrapped in a decorator object inside this container.


PersistentSearchDecorator

public PersistentSearchDecorator(LdapCodecService codec,
                                 PersistentSearch control)
Creates a PersistentSearch Control wrapping a supplied PersistentSearch Control.

Parameters:
control - The PersistentSearch Control to wrap.
Method Detail

computeLength

public int computeLength()
Compute the PagedSearchControl length, which is the sum of the control length and the value length.
 PersistentSearchDecorator value length :
 
 0x30 L1 
   | 
   +--> 0x02 0x0(1-4) [0..2^31-1] (changeTypes) 
   +--> 0x01 0x01 [0x00 | 0xFF] (changeOnly) 
   +--> 0x01 0x01 [0x00 | 0xFF] (returnRCs)
 

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

encode

public ByteBuffer encode(ByteBuffer buffer)
                  throws EncoderException
Encodes the persistent search control.

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

setChangesOnly

public void setChangesOnly(boolean changesOnly)
Specified by:
setChangesOnly in interface PersistentSearch

isChangesOnly

public boolean isChangesOnly()
Specified by:
isChangesOnly in interface PersistentSearch

setReturnECs

public void setReturnECs(boolean returnECs)
Specified by:
setReturnECs in interface PersistentSearch

isReturnECs

public boolean isReturnECs()
Specified by:
isReturnECs in interface PersistentSearch

setChangeTypes

public void setChangeTypes(int changeTypes)
Specified by:
setChangeTypes in interface PersistentSearch

getChangeTypes

public int getChangeTypes()
Specified by:
getChangeTypes in interface PersistentSearch

isNotificationEnabled

public boolean isNotificationEnabled(ChangeType changeType)
Specified by:
isNotificationEnabled in interface PersistentSearch

enableNotification

public void enableNotification(ChangeType changeType)
Specified by:
enableNotification in interface PersistentSearch

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