org.apache.directory.shared.ldap.codec.search
Class SearchRequestCodec

java.lang.Object
  extended by org.apache.directory.shared.asn1.AbstractAsn1Object
      extended by org.apache.directory.shared.ldap.codec.LdapMessageCodec
          extended by org.apache.directory.shared.ldap.codec.search.SearchRequestCodec
All Implemented Interfaces:
Asn1Object

public class SearchRequestCodec
extends LdapMessageCodec

A SearchRequest ldapObject. It's a sub-class of Asn1Object, and it implements the ldapObject class to be seen as a member of the LdapMessage CHOICE.

Version:
$Rev: 919009 $, $Date: 2010-03-04 15:57:10 +0100 (Thu, 04 Mar 2010) $,
Author:
Apache Directory Project

Field Summary
 
Fields inherited from class org.apache.directory.shared.ldap.codec.LdapMessageCodec
ldapMessageLength
 
Fields inherited from class org.apache.directory.shared.asn1.AbstractAsn1Object
parent
 
Constructor Summary
SearchRequestCodec()
          Creates a new SearchRequest object.
 
Method Summary
 void addAttribute(java.lang.String attribute)
          Add an attribute to the attributes list.
 void addCurrentFilter(Filter localFilter)
          Add a current filter.
protected  int computeLengthProtocolOp()
          Compute the SearchRequest length SearchRequest :
protected  void encodeProtocolOp(java.nio.ByteBuffer buffer)
          Encode the SearchRequest message to a PDU.
 java.util.List<EntryAttribute> getAttributes()
          Get the list of attributes
 DN getBaseObject()
          Get the base object
 Filter getCurrentFilter()
          Get the current dilter
 int getDerefAliases()
          Get the derefAliases flag
 Filter getFilter()
          Get the filter
 MessageTypeEnum getMessageType()
          Get the message type
 java.lang.String getMessageTypeName()
          Get the message type Name
 SearchScope getScope()
          Get the search scope
 long getSizeLimit()
          Get the size limit
 Filter getTerminalFilter()
          Get the comparison dilter
 int getTimeLimit()
          Get the time limit
 boolean isTypesOnly()
          Get the typesOnly flag
 void setBaseObject(DN baseObject)
          Set the base object
 void setCurrentFilter(Filter filter)
          Set the current dilter
 void setDerefAliases(int derefAliases)
          Set the derefAliases flag
 void setFilter(Filter filter)
          Set the filter
 void setScope(SearchScope scope)
          Set the search scope
 void setSizeLimit(long sizeLimit)
          Set the size limit
 void setTerminalFilter(Filter terminalFilter)
          Set the terminal filter
 void setTimeLimit(int timeLimit)
          Set the time limit
 void setTypesOnly(boolean typesOnly)
          Set the typesOnly flag
 java.lang.String toString()
          Return a string the represent a SearchRequest
 void unstackFilters(IAsn1Container container)
          This method is used to clear the filter's stack for terminated elements.
 
Methods inherited from class org.apache.directory.shared.ldap.codec.LdapMessageCodec
addControl, addControls, computeLength, encode, getCodecControl, getControls, getControls, getCurrentControl, getMessageId, initControls, setMessageId, toString
 
Methods inherited from class org.apache.directory.shared.asn1.AbstractAsn1Object
addLength, encode, getCurrentLength, getExpectedLength, getParent, getTlvId, setCurrentLength, setExpectedLength, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SearchRequestCodec

public SearchRequestCodec()
Creates a new SearchRequest object.

Method Detail

getMessageType

public MessageTypeEnum getMessageType()
Get the message type

Specified by:
getMessageType in class LdapMessageCodec
Returns:
Returns the type.

getMessageTypeName

public java.lang.String getMessageTypeName()
Get the message type Name

Specified by:
getMessageTypeName in class LdapMessageCodec
Returns:
The message type name

getAttributes

public java.util.List<EntryAttribute> getAttributes()
Get the list of attributes

Returns:
Returns the attributes.

addAttribute

public void addAttribute(java.lang.String attribute)
Add an attribute to the attributes list.

Parameters:
attribute - The attribute to add to the list

getBaseObject

public DN getBaseObject()
Get the base object

Returns:
Returns the baseObject.

setBaseObject

public void setBaseObject(DN baseObject)
Set the base object

Parameters:
baseObject - The baseObject to set.

getDerefAliases

public int getDerefAliases()
Get the derefAliases flag

Returns:
Returns the derefAliases.

setDerefAliases

public void setDerefAliases(int derefAliases)
Set the derefAliases flag

Parameters:
derefAliases - The derefAliases to set.

getFilter

public Filter getFilter()
Get the filter

Returns:
Returns the filter.

setFilter

public void setFilter(Filter filter)
Set the filter

Parameters:
filter - The filter to set.

getScope

public SearchScope getScope()
Get the search scope

Returns:
Returns the scope.

setScope

public void setScope(SearchScope scope)
Set the search scope

Parameters:
scope - The scope to set.

getSizeLimit

public long getSizeLimit()
Get the size limit

Returns:
Returns the sizeLimit.

setSizeLimit

public void setSizeLimit(long sizeLimit)
Set the size limit

Parameters:
sizeLimit - The sizeLimit to set.

getTimeLimit

public int getTimeLimit()
Get the time limit

Returns:
Returns the timeLimit.

setTimeLimit

public void setTimeLimit(int timeLimit)
Set the time limit

Parameters:
timeLimit - The timeLimit to set.

isTypesOnly

public boolean isTypesOnly()
Get the typesOnly flag

Returns:
Returns the typesOnly.

setTypesOnly

public void setTypesOnly(boolean typesOnly)
Set the typesOnly flag

Parameters:
typesOnly - The typesOnly to set.

getCurrentFilter

public Filter getCurrentFilter()
Get the current dilter

Returns:
Returns the currentFilter.

getTerminalFilter

public Filter getTerminalFilter()
Get the comparison dilter

Returns:
Returns the comparisonFilter.

setTerminalFilter

public void setTerminalFilter(Filter terminalFilter)
Set the terminal filter

Parameters:
terminalFilter - the teminalFilter.

addCurrentFilter

public void addCurrentFilter(Filter localFilter)
                      throws DecoderException
Add a current filter. We have two cases : - there is no previous current filter : the filter is the top level filter - there is a previous current filter : the filter is added to the currentFilter set, and the current filter is changed In any case, the previous current filter will always be a ConnectorFilter when this method is called.

Parameters:
localFilter - The filter to set.
Throws:
DecoderException

setCurrentFilter

public void setCurrentFilter(Filter filter)
Set the current dilter

Parameters:
filter - The filter to set.

unstackFilters

public void unstackFilters(IAsn1Container container)
This method is used to clear the filter's stack for terminated elements. An element is considered as terminated either if : - it's a final element (ie an element which cannot contains a Filter) - its current length equals its expected length.

Parameters:
container - The container being decoded

computeLengthProtocolOp

protected int computeLengthProtocolOp()
Compute the SearchRequest length SearchRequest :
 0x63 L1
  |
  +--> 0x04 L2 baseObject
  +--> 0x0A 0x01 scope
  +--> 0x0A 0x01 derefAliases
  +--> 0x02 0x0(1..4) sizeLimit
  +--> 0x02 0x0(1..4) timeLimit
  +--> 0x01 0x01 typesOnly
  +--> filter.computeLength()
  +--> 0x30 L3 (Attribute description list)
        |
        +--> 0x04 L4-1 Attribute description 
        +--> 0x04 L4-2 Attribute description 
        +--> ... 
        +--> 0x04 L4-i Attribute description 
        +--> ... 
        +--> 0x04 L4-n Attribute description 
        

Specified by:
computeLengthProtocolOp in class LdapMessageCodec

encodeProtocolOp

protected void encodeProtocolOp(java.nio.ByteBuffer buffer)
                         throws EncoderException
Encode the SearchRequest message to a PDU. SearchRequest :
 0x63 LL
   0x04 LL baseObject
   0x0A 01 scope
   0x0A 01 derefAliases
   0x02 0N sizeLimit
   0x02 0N timeLimit
   0x01 0x01 typesOnly
   filter.encode()
   0x30 LL attributeDescriptionList
     0x04 LL attributeDescription
     ... 
     0x04 LL attributeDescription
 

Specified by:
encodeProtocolOp in class LdapMessageCodec
Parameters:
buffer - The buffer where to put the PDU
Throws:
EncoderException

toString

public java.lang.String toString()
Return a string the represent a SearchRequest

Overrides:
toString in class java.lang.Object


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