Class AbstractMessage
- java.lang.Object
-
- org.apache.directory.api.ldap.model.message.AbstractMessage
-
- All Implemented Interfaces:
Message
- Direct Known Subclasses:
AbstractRequest,AbstractResponse
public abstract class AbstractMessage extends Object implements Message
Abstract message base class.- Author:
- Apache Directory Project
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractMessage(int id, MessageTypeEnum type)Completes the instantiation of a Message.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MessageaddAllControls(Control[] controls)Adds an array of controls to this Message.MessageaddControl(Control control)Adds a control to this Message.booleanequals(Object obj)Checks to see if two messages are equivalent.Objectget(Object key)Gets a message scope parameter.ControlgetControl(String oid)Gets the control associated with the given OID.Map<String,Control>getControls()Gets the controls associated with this message mapped by OID.intgetMessageId()Gets the session unique message sequence id for this message.MessageTypeEnumgetType()Gets the LDAP message type code associated with this Message.booleanhasControl(String oid)Checks whether or not this message has the specified control.inthashCode()Objectput(Object key, Object value)Sets a message scope parameter.MessageremoveControl(Control control)Deletes a control removing it from this Message.MessagesetMessageId(int id)Sets the Message ID for this requestStringtoString(String message)Get a String representation of a LdapMessage
-
-
-
Constructor Detail
-
AbstractMessage
protected AbstractMessage(int id, MessageTypeEnum type)Completes the instantiation of a Message.- Parameters:
id- the seq id of the messagetype- 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:
getMessageIdin interfaceMessage- Returns:
- the session unique message id.
-
setMessageId
public Message setMessageId(int id)
Sets the Message ID for this request- Specified by:
setMessageIdin interfaceMessage- Parameters:
id- The message Id- Returns:
- A Message reference
-
getControls
public Map<String,Control> getControls()
Gets the controls associated with this message mapped by OID.- Specified by:
getControlsin interfaceMessage- Returns:
- Map of OID strings to Control object instances.
-
getControl
public Control getControl(String oid)
Gets the control associated with the given OID.- Specified by:
getControlin interfaceMessage- Parameters:
oid- The Cntrol's OID we are looking for- Returns:
- The Control object instance with the OID.
-
hasControl
public boolean hasControl(String oid)
Checks whether or not this message has the specified control.- Specified by:
hasControlin interfaceMessage- Parameters:
oid- the OID of the control- Returns:
- true if this message has the control, false if it does not
-
addControl
public Message addControl(Control control)
Adds a control to this Message.- Specified by:
addControlin interfaceMessage- Parameters:
control- the control to add.- Returns:
- A Message reference
-
removeControl
public Message removeControl(Control control)
Deletes a control removing it from this Message.- Specified by:
removeControlin interfaceMessage- Parameters:
control- the control to remove.- Returns:
- A Message reference
-
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.
-
get
public Object get(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 received, 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.
-
put
public Object put(Object key, 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.
-
equals
public boolean equals(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.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classObject- Returns:
- the instance's hash code
- See Also:
Object.hashCode()
-
addAllControls
public Message addAllControls(Control[] controls)
Adds an array of controls to this Message.- Specified by:
addAllControlsin interfaceMessage- Parameters:
controls- the controls to add.- Returns:
- A Message reference
-
-