org.apache.directory.shared.ldap.message
Class AbstractMessage

java.lang.Object
  extended byorg.apache.directory.shared.ldap.message.AbstractMessage
All Implemented Interfaces:
Message
Direct Known Subclasses:
AbstractRequest, AbstractResponse

public class AbstractMessage
extends java.lang.Object
implements Message

Abstract message base class.

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

Constructor Summary
protected AbstractMessage(int id, MessageTypeEnum type)
          Completes the instantiation of a Message.
 
Method Summary
 void add(Control control)
          Adds a control to this Message.
 boolean equals(java.lang.Object obj)
          Checks to see if two messages are equivalent.
 java.lang.Object get(java.lang.Object key)
          Gets a message scope parameter.
 java.util.Map getControls()
          Gets the controls associated with this message mapped by OID.
 int getMessageId()
          Gets the session unique message sequence id for this message.
 MessageTypeEnum getType()
          Gets the LDAP message type code associated with this Message.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Sets a message scope parameter.
 void remove(Control control)
          Deletes a control removing it from this Message.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractMessage

protected AbstractMessage(int id,
                          MessageTypeEnum type)
Completes the instantiation of a Message.

Parameters:
id - the seq id of the message
type - the type 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.

getControls

public java.util.Map 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

add

public void add(Control control)
         throws MessageException
Adds a control to this Message.

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

remove

public void remove(Control control)
            throws MessageException
Deletes a control removing it from this Message.

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

getType

public MessageTypeEnum getType()
Gets the LDAP message type code associated with this Message. Each request and response type has a unique message type code defined by the protocol in RFC 2251.

Specified by:
getType in interface Message
Returns:
the message type code.

get

public java.lang.Object get(java.lang.Object key)
Gets a message scope parameter. Message scope parameters are temporary variables associated with a message and are set locally to be used to associate housekeeping information with a request or its processing. These parameters are never transmitted nor recieved, think of them as transient data associated with the message or its processing. These transient parameters are not locked down so modifications can occur without firing LockExceptions even when this Lockable is in the locked state.

Specified by:
get in interface Message
Parameters:
key - the key used to access a message parameter.
Returns:
the transient message parameter value.

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Sets a message scope parameter. These transient parameters are not locked down so modifications can occur without firing LockExceptions even when this Lockable is in the locked state.

Specified by:
put in interface Message
Parameters:
key - the parameter key
value - the parameter value
Returns:
the old value or null

equals

public boolean equals(java.lang.Object obj)
Checks to see if two messages are equivalent. Messages equivalence does not factor in parameters accessible through the get() and put() operations, nor do they factor in the Lockable properties of the Message. Only the type, controls, and the messageId are evaluated for equality.

Parameters:
obj - the object to compare this Message to for equality


Copyright © 2003-2006 . All Rights Reserved.