org.apache.directory.shared.ldap.codec.decorators
Class SearchResultEntryDecorator

java.lang.Object
  extended by org.apache.directory.shared.ldap.codec.decorators.MessageDecorator<SearchResultEntry>
      extended by org.apache.directory.shared.ldap.codec.decorators.SearchResultEntryDecorator
All Implemented Interfaces:
Decorator<SearchResultEntry>, Message, Response, SearchResultEntry

public class SearchResultEntryDecorator
extends MessageDecorator<SearchResultEntry>
implements SearchResultEntry

A decorator for the SearchResultEntry message

Author:
Apache Directory Project

Field Summary
 
Fields inherited from class org.apache.directory.shared.ldap.codec.decorators.MessageDecorator
messageLength
 
Fields inherited from interface org.apache.directory.shared.ldap.model.message.SearchResultEntry
TYPE
 
Constructor Summary
SearchResultEntryDecorator(LdapCodecService codec, SearchResultEntry decoratedMessage)
          Makes a SearchResultEntry encodable.
 
Method Summary
 void addAttribute(String type)
          Create a new attribute
 void addAttributeValue(Object value)
          Add a new value to the current attribute
 int computeLength()
          Compute the SearchResultEntry length SearchResultEntry :
 ByteBuffer encode(ByteBuffer buffer)
          Encode the SearchResultEntry message to a PDU.
 List<Integer> getAttributeLength()
           
 int getAttributesLength()
           
 EntryAttribute getCurrentAttribute()
           
 Entry getEntry()
          
 Dn getObjectName()
          
 byte[] getObjectNameBytes()
          Gets the distinguished name bytes of the entry object returned.
 int getSearchResultEntryLength()
           
 List<Integer> getValsLength()
           
 void setAttributeLength(List<Integer> attributeLength)
           
 void setAttributesLength(int attributesLength)
          Stores the encoded length for the Attributes
 void setEntry(Entry entry)
          
 void setObjectName(Dn objectName)
          
 void setObjectNameBytes(byte[] objectNameBytes)
          Sets the distinguished name bytes of the entry object returned.
 void setSearchResultEntryLength(int searchResultEntryLength)
          Stores the encoded length for the SearchResultEntry
 void setValsLength(List<Integer> valsLength)
          Stores the list of encoded length for the values
 
Methods inherited from class org.apache.directory.shared.ldap.codec.decorators.MessageDecorator
addAllControls, addControl, get, getCodecService, getControl, getControls, getControlsLength, getCurrentControl, getDecorated, getDecorator, getMessageId, getMessageLength, getType, hasControl, put, removeControl, setControlsLength, setMessageId, setMessageLength, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.directory.shared.ldap.model.message.Message
addAllControls, addControl, get, getControl, getControls, getMessageId, getType, hasControl, put, removeControl, setMessageId
 

Constructor Detail

SearchResultEntryDecorator

public SearchResultEntryDecorator(LdapCodecService codec,
                                  SearchResultEntry decoratedMessage)
Makes a SearchResultEntry encodable.

Parameters:
decoratedMessage - the decorated SearchResultEntry
Method Detail

getObjectNameBytes

public byte[] getObjectNameBytes()
Gets the distinguished name bytes of the entry object returned.

Returns:
the Dn bytes of the entry returned.

setObjectNameBytes

public void setObjectNameBytes(byte[] objectNameBytes)
Sets the distinguished name bytes of the entry object returned.

Parameters:
objectNameBytes - the Dn bytes of the entry returned.

getSearchResultEntryLength

public int getSearchResultEntryLength()
Returns:
The encoded SearchResultEntry's length

setSearchResultEntryLength

public void setSearchResultEntryLength(int searchResultEntryLength)
Stores the encoded length for the SearchResultEntry

Parameters:
searchResultEntryLength - The encoded length

getAttributesLength

public int getAttributesLength()
Returns:
The encoded PartialAttributeList's length

setAttributesLength

public void setAttributesLength(int attributesLength)
Stores the encoded length for the Attributes

Parameters:
attributesLength - The list of encoded lengths

getAttributeLength

public List<Integer> getAttributeLength()
Returns:
The encoded PartialAttributeList's length

setAttributeLength

public void setAttributeLength(List<Integer> attributeLength)

getValsLength

public List<Integer> getValsLength()
Returns:
The list of encoded values' length

setValsLength

public void setValsLength(List<Integer> valsLength)
Stores the list of encoded length for the values

Parameters:
valsLength - The list of encoded lengths

getCurrentAttribute

public EntryAttribute getCurrentAttribute()

addAttribute

public void addAttribute(String type)
                  throws LdapException
Create a new attribute

Parameters:
type - The attribute's type
Throws:
LdapException

addAttributeValue

public void addAttributeValue(Object value)
Add a new value to the current attribute

Parameters:
value - The added value

getObjectName

public Dn getObjectName()

Specified by:
getObjectName in interface SearchResultEntry

setObjectName

public void setObjectName(Dn objectName)

Specified by:
setObjectName in interface SearchResultEntry

getEntry

public Entry getEntry()

Specified by:
getEntry in interface SearchResultEntry

setEntry

public void setEntry(Entry entry)

Specified by:
setEntry in interface SearchResultEntry

computeLength

public int computeLength()
Compute the SearchResultEntry length SearchResultEntry :
 0x64 L1
  |
  +--> 0x04 L2 objectName
  +--> 0x30 L3 (attributes)
        |
        +--> 0x30 L4-1 (partial attributes list)
        |     |
        |     +--> 0x04 L5-1 type
        |     +--> 0x31 L6-1 (values)
        |           |
        |           +--> 0x04 L7-1-1 value
        |           +--> ...
        |           +--> 0x04 L7-1-n value
        |
        +--> 0x30 L4-2 (partial attributes list)
        |     |
        |     +--> 0x04 L5-2 type
        |     +--> 0x31 L6-2 (values)
        |           |
        |           +--> 0x04 L7-2-1 value
        |           +--> ...
        |           +--> 0x04 L7-2-n value
        |
        +--> ...
        |
        +--> 0x30 L4-m (partial attributes list)
              |
              +--> 0x04 L5-m type
              +--> 0x31 L6-m (values)
                    |
                    +--> 0x04 L7-m-1 value
                    +--> ...
                    +--> 0x04 L7-m-n value
 

Specified by:
computeLength in interface Decorator<SearchResultEntry>
Returns:
The object's computed length

encode

public ByteBuffer encode(ByteBuffer buffer)
                  throws EncoderException
Encode the SearchResultEntry message to a PDU. SearchResultEntry :
 0x64 LL
   0x04 LL objectName
   0x30 LL attributes
     0x30 LL partialAttributeList
       0x04 LL type
       0x31 LL vals
         0x04 LL attributeValue
         ... 
         0x04 LL attributeValue
     ... 
     0x30 LL partialAttributeList
       0x04 LL type
       0x31 LL vals
         0x04 LL attributeValue
         ... 
         0x04 LL attributeValue 
 

Specified by:
encode in interface Decorator<SearchResultEntry>
Parameters:
buffer - The buffer where to put the PDU
searchResultEntryDecorator - the SearchResultEntry decorator
Returns:
The PDU.
Throws:
EncoderException - if the buffer can't be encoded


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