Package org.apache.directory.api.dsmlv2
Class AbstractDsmlMessageDecorator<M extends Message>
- java.lang.Object
-
- org.apache.directory.api.dsmlv2.AbstractDsmlMessageDecorator<M>
-
- Type Parameters:
M
- The message to decorate
- All Implemented Interfaces:
DsmlDecorator<M>
,Message
- Direct Known Subclasses:
AbstractRequestDsml
,AbstractResponseDsml
public abstract class AbstractDsmlMessageDecorator<M extends Message> extends Object implements DsmlDecorator<M>, Message
An abstract DSML Message decorator base class.- Author:
- Apache Directory Project
-
-
Constructor Summary
Constructors Constructor Description AbstractDsmlMessageDecorator(LdapApiService codec, M message)
Create a new instance of AbstractDsmlMessageDecorator
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Message
addAllControls(Control[] controlsToAdd)
Adds an array of controls to this Message.Message
addControl(Control control)
Adds a control to this Message.Object
get(Object key)
Gets a message scope parameter.LdapApiService
getCodecService()
Control
getControl(String oid)
Gets the control associated with the given OID.Map<String,Control>
getControls()
Gets the controls associated with this message mapped by OID.DsmlControl<? extends Control>
getCurrentControl()
Get the current Control ObjectM
getDecorated()
Gets the Message this DsmlDecorator decorates.int
getMessageId()
Gets the session unique message sequence id for this message.MessageTypeEnum
getType()
Gets the LDAP message type code associated with this Message.boolean
hasControl(String oid)
Checks whether or not this message has the specified control.Object
put(Object key, Object value)
Sets a message scope parameter.Message
removeControl(Control control)
Deletes a control removing it from this Message.Message
setMessageId(int messageId)
Sets the Message ID for this request-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.directory.api.dsmlv2.DsmlDecorator
toDsml
-
-
-
-
Constructor Detail
-
AbstractDsmlMessageDecorator
public AbstractDsmlMessageDecorator(LdapApiService codec, M message)
Create a new instance of AbstractDsmlMessageDecorator- Parameters:
codec
- The codec to usemessage
- The message to decorate
-
-
Method Detail
-
getCurrentControl
public DsmlControl<? extends Control> getCurrentControl()
Get the current Control Object- Returns:
- The current Control Object
-
getCodecService
public LdapApiService getCodecService()
- Returns:
- The codec to use to encode or decode this message
-
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.
-
getControls
public Map<String,Control> getControls()
Gets the controls associated with this message mapped by OID.- Specified by:
getControls
in 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:
getControl
in 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:
hasControl
in 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:
addControl
in interfaceMessage
- Parameters:
control
- the control to add.- Returns:
- A Message reference
-
addAllControls
public Message addAllControls(Control[] controlsToAdd)
Adds an array of controls to this Message.- Specified by:
addAllControls
in interfaceMessage
- Parameters:
controlsToAdd
- the controls to add.- Returns:
- A Message reference
-
removeControl
public Message removeControl(Control control)
Deletes a control removing it from this Message.- Specified by:
removeControl
in interfaceMessage
- Parameters:
control
- the control to remove.- Returns:
- A Message reference
-
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 interfaceMessage
- Returns:
- the session unique message id.
-
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 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.
-
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.
-
setMessageId
public Message setMessageId(int messageId)
Sets the Message ID for this request- Specified by:
setMessageId
in interfaceMessage
- Parameters:
messageId
- The message Id- Returns:
- A Message reference
-
getDecorated
public M getDecorated()
Gets the Message this DsmlDecorator decorates.- Specified by:
getDecorated
in interfaceDsmlDecorator<M extends Message>
- Returns:
- The decorated Message instance
-
-