org.apache.directory.ldap.client.api.message
Class AbstractMessage

java.lang.Object
  extended by org.apache.directory.ldap.client.api.message.AbstractMessage
All Implemented Interfaces:
Message
Direct Known Subclasses:
AbstractRequest, AbstractResponseWithResult, SearchIntermediateResponse, SearchResultEntry, SearchResultReference

public abstract class AbstractMessage
extends java.lang.Object
implements Message

Abstract message base class.

Version:
$Rev: 760984 $
Author:
Apache Directory Project

Constructor Summary
protected AbstractMessage()
          Completes the instanciation of a Message.
 
Method Summary
 Message add(org.apache.directory.shared.ldap.message.control.Control... controls)
          Adds controls to this Message.
 org.apache.directory.shared.ldap.message.control.Control getControl(java.lang.String oid)
          Gets the control with a specific OID.
 java.util.Map<java.lang.String,org.apache.directory.shared.ldap.message.control.Control> getControls()
          Gets the controls associated with this message mapped by OID.
 int getMessageId()
          Gets the session unique message sequence id for this message.
 boolean hasControl(java.lang.String oid)
          Checks whether or not this message has the specified control.
 Message remove(org.apache.directory.shared.ldap.message.control.Control... controls)
          Deletes controls, removing them from this Message.
 void setMessageId(int messageId)
          Set the request message ID
 java.lang.String toString()
          Get a String representation of a LdapMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractMessage

protected AbstractMessage()
Completes the instanciation of a Message.

Parameters:
messageId - the seq id of the message
Method Detail

getMessageId

public int getMessageId()
Gets the session unique message sequence id for this message. Requests and their responses if any have the same message id. Clients at the initialization of a session start with the first message's id set to 1 and increment it with each transaction.

Specified by:
getMessageId in interface Message
Returns:
the session unique message id.

setMessageId

public void setMessageId(int messageId)
Set the request message ID

Specified by:
setMessageId in interface Message
Parameters:
messageId -

add

public Message add(org.apache.directory.shared.ldap.message.control.Control... controls)
Adds controls to this Message.

Specified by:
add in interface Message
Parameters:
controls - the controls to add.

getControls

public java.util.Map<java.lang.String,org.apache.directory.shared.ldap.message.control.Control> getControls()
Gets the controls associated with this message mapped by OID.

Specified by:
getControls in interface Message
Returns:
Map of OID strings to Control object instances.
See Also:
Control

getControl

public org.apache.directory.shared.ldap.message.control.Control getControl(java.lang.String oid)
Gets the control with a specific OID.

Specified by:
getControl in interface Message
Returns:
The Control with the specified OID
See Also:
Control

hasControl

public boolean hasControl(java.lang.String oid)
Checks whether or not this message has the specified control.

Specified by:
hasControl in interface Message
Parameters:
oid - the OID of the control
Returns:
true if this message has the control, false if it does not

remove

public Message remove(org.apache.directory.shared.ldap.message.control.Control... controls)
               throws LdapException
Deletes controls, removing them from this Message.

Specified by:
remove in interface Message
Throws:
LdapException - if controls cannot be added to this Message or the control is not known etc.

toString

public java.lang.String toString()
Get a String representation of a LdapMessage

Overrides:
toString in class java.lang.Object
Returns:
A LdapMessage String


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