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

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.SearchResultEntryCodec
All Implemented Interfaces:
Asn1Object

public class SearchResultEntryCodec
extends LdapMessageCodec

A SearchResultEntry Message. Its syntax is : SearchResultEntry ::= [APPLICATION 4] SEQUENCE { objectName LDAPDN, attributes PartialAttributeList } PartialAttributeList ::= SEQUENCE OF SEQUENCE { type AttributeDescription, vals SET OF AttributeValue } AttributeDescription ::= LDAPString AttributeValue ::= OCTET STRING It contains an entry, with all its attributes, and all the attributes values. If a search request is submited, all the results are sent one by one, followed by a searchResultDone message.

Version:
$Rev: 923524 $, $Date: 2010-03-16 01:31:36 +0100 (Tue, 16 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
SearchResultEntryCodec()
          Creates a new SearchResultEntry object.
 
Method Summary
 void addAttributeValue(java.lang.Object value)
          Add a new value to the current attribute
 void addAttributeValues(java.lang.String type)
          Create a new attributeValue
protected  int computeLengthProtocolOp()
          Compute the SearchResultEntry length SearchResultEntry :
protected  void encodeProtocolOp(java.nio.ByteBuffer buffer)
          Encode the SearchResultEntry message to a PDU.
 java.lang.String getCurrentAttributeValueType()
           
 Entry getEntry()
          Get the entry.
 MessageTypeEnum getMessageType()
          Get the message type
 java.lang.String getMessageTypeName()
          Get the message type Name
 DN getObjectName()
          Get the entry DN
 void setEntry(Entry entry)
          Sets the entry.
 void setObjectName(DN objectName)
          Set the entry DN.
 java.lang.String toString()
          Returns the Search Result Entry string
 
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

SearchResultEntryCodec

public SearchResultEntryCodec()
Creates a new SearchResultEntry 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

getObjectName

public DN getObjectName()
Get the entry DN

Returns:
Returns the objectName.

setObjectName

public void setObjectName(DN objectName)
Set the entry DN.

Parameters:
objectName - The objectName to set.

getEntry

public Entry getEntry()
Get the entry.

Returns:
Returns the entry

setEntry

public void setEntry(Entry entry)
Sets the entry.

Parameters:
entry - the entry

addAttributeValues

public void addAttributeValues(java.lang.String type)
Create a new attributeValue

Parameters:
type - The attribute's name

addAttributeValue

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

Parameters:
value -

computeLengthProtocolOp

protected int computeLengthProtocolOp()
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:
computeLengthProtocolOp in class LdapMessageCodec

encodeProtocolOp

protected void encodeProtocolOp(java.nio.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:
encodeProtocolOp in class LdapMessageCodec
Parameters:
buffer - The buffer where to put the PDU
Throws:
EncoderException

toString

public java.lang.String toString()
Returns the Search Result Entry string

Overrides:
toString in class java.lang.Object
Returns:
The Search Result Entry string

getCurrentAttributeValueType

public java.lang.String getCurrentAttributeValueType()
Returns:
Returns the currentAttributeValue.


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