Class AddRequestDecorator
- java.lang.Object
-
- org.apache.directory.api.ldap.codec.api.MessageDecorator<M>
-
- org.apache.directory.api.ldap.codec.decorators.RequestDecorator<M>
-
- org.apache.directory.api.ldap.codec.decorators.ResultResponseRequestDecorator<M>
-
- org.apache.directory.api.ldap.codec.decorators.SingleReplyRequestDecorator<AddRequest>
-
- org.apache.directory.api.ldap.codec.decorators.AddRequestDecorator
-
- All Implemented Interfaces:
Asn1Object
,Decorator<AddRequest>
,AbandonableRequest
,AddRequest
,Message
,Request
,ResultResponseRequest
,SingleReplyRequest
public final class AddRequestDecorator extends SingleReplyRequestDecorator<AddRequest> implements AddRequest
A decorator for the AddRequest message- Author:
- Apache Directory Project
-
-
Constructor Summary
Constructors Constructor Description AddRequestDecorator(LdapApiService codec, AddRequest decoratedMessage)
Makes a AddRequest a MessageDecorator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AddRequest
addAllControls(Control[] controls)
Adds an array of controls to this Message.void
addAttributeType(String type)
Create a new attributeValuevoid
addAttributeValue(byte[] value)
Add a new value to the current attributevoid
addAttributeValue(String value)
Add a new value to the current attributevoid
addAttributeValue(Value value)
Add a new value to the current attributeAddRequest
addControl(Control control)
Adds a control to this Message.int
computeLength()
Compute the AddRequest length
AddRequest :ByteBuffer
encode(ByteBuffer buffer)
Encode the AddRequest message to a PDU.String
getCurrentAttributeType()
Entry
getEntry()
Gets the entry to add.Dn
getEntryDn()
Gets the distinguished name of the entry to add.AddRequest
removeControl(Control control)
Deletes a control removing it from this Message.AddRequest
setEntry(Entry entry)
Sets the Entry to add.AddRequest
setEntryDn(Dn entry)
Sets the distinguished name of the entry to add.AddRequest
setMessageId(int messageId)
Sets the Message ID for this request-
Methods inherited from class org.apache.directory.api.ldap.codec.decorators.SingleReplyRequestDecorator
abandon, addAbandonListener, getResponseType, isAbandoned
-
Methods inherited from class org.apache.directory.api.ldap.codec.decorators.ResultResponseRequestDecorator
getResultResponse, hasResponse
-
Methods inherited from class org.apache.directory.api.ldap.codec.api.MessageDecorator
get, getCodecService, getControl, getControls, getControlsLength, getCurrentControl, getDecorated, getDecorator, getMessageId, getMessageLength, getType, hasControl, put, setControlsLength, setMessageLength, toString
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.directory.api.ldap.model.message.AbandonableRequest
abandon, addAbandonListener, isAbandoned
-
Methods inherited from interface org.apache.directory.api.ldap.model.message.Message
get, getControl, getControls, getMessageId, getType, hasControl, put
-
Methods inherited from interface org.apache.directory.api.ldap.model.message.Request
hasResponse
-
Methods inherited from interface org.apache.directory.api.ldap.model.message.ResultResponseRequest
getResultResponse
-
Methods inherited from interface org.apache.directory.api.ldap.model.message.SingleReplyRequest
getResponseType
-
-
-
-
Constructor Detail
-
AddRequestDecorator
public AddRequestDecorator(LdapApiService codec, AddRequest decoratedMessage)
Makes a AddRequest a MessageDecorator.- Parameters:
codec
- The LDAP service instancedecoratedMessage
- the decorated AddRequest
-
-
Method Detail
-
setMessageId
public AddRequest setMessageId(int messageId)
Sets the Message ID for this request- Specified by:
setMessageId
in interfaceAddRequest
- Specified by:
setMessageId
in interfaceMessage
- Overrides:
setMessageId
in classMessageDecorator<AddRequest>
- Parameters:
messageId
- The message Id- Returns:
- A Message reference
-
addControl
public AddRequest addControl(Control control)
Adds a control to this Message.- Specified by:
addControl
in interfaceAddRequest
- Specified by:
addControl
in interfaceMessage
- Overrides:
addControl
in classMessageDecorator<AddRequest>
- Parameters:
control
- the control to add.- Returns:
- A Message reference
-
addAllControls
public AddRequest addAllControls(Control[] controls)
Adds an array of controls to this Message.- Specified by:
addAllControls
in interfaceAddRequest
- Specified by:
addAllControls
in interfaceMessage
- Overrides:
addAllControls
in classMessageDecorator<AddRequest>
- Parameters:
controls
- the controls to add.- Returns:
- A Message reference
-
removeControl
public AddRequest removeControl(Control control)
Deletes a control removing it from this Message.- Specified by:
removeControl
in interfaceAddRequest
- Specified by:
removeControl
in interfaceMessage
- Overrides:
removeControl
in classMessageDecorator<AddRequest>
- Parameters:
control
- the control to remove.- Returns:
- A Message reference
-
getEntryDn
public Dn getEntryDn()
Gets the distinguished name of the entry to add.- Specified by:
getEntryDn
in interfaceAddRequest
- Returns:
- the Dn of the added entry.
-
setEntryDn
public AddRequest setEntryDn(Dn entry)
Sets the distinguished name of the entry to add.- Specified by:
setEntryDn
in interfaceAddRequest
- Parameters:
entry
- the Dn of the added entry.- Returns:
- The AddRequest instance
-
getEntry
public Entry getEntry()
Gets the entry to add.- Specified by:
getEntry
in interfaceAddRequest
- Returns:
- the added Entry
-
setEntry
public AddRequest setEntry(Entry entry)
Sets the Entry to add.- Specified by:
setEntry
in interfaceAddRequest
- Parameters:
entry
- the added Entry- Returns:
- The AddRequest instance
-
addAttributeType
public void addAttributeType(String type) throws LdapException
Create a new attributeValue- Parameters:
type
- The attribute's name (called 'type' in the grammar)- Throws:
LdapException
- If the value is invalid
-
getCurrentAttributeType
public String getCurrentAttributeType()
- Returns:
- Returns the currentAttribute type.
-
addAttributeValue
public void addAttributeValue(String value) throws LdapException
Add a new value to the current attribute- Parameters:
value
- The value to add- Throws:
LdapException
- If the value is invalid
-
addAttributeValue
public void addAttributeValue(Value value) throws LdapException
Add a new value to the current attribute- Parameters:
value
- The value to add- Throws:
LdapException
- If the value is invalid
-
addAttributeValue
public void addAttributeValue(byte[] value) throws LdapException
Add a new value to the current attribute- Parameters:
value
- The value to add- Throws:
LdapException
- If the value is invalid
-
computeLength
public int computeLength()
Compute the AddRequest length
AddRequest :0x68 L1 | +--> 0x04 L2 entry +--> 0x30 L3 (attributes) | +--> 0x30 L4-1 (attribute) | | | +--> 0x04 L5-1 type | +--> 0x31 L6-1 (values) | | | +--> 0x04 L7-1-1 value | +--> ... | +--> 0x04 L7-1-n value | +--> 0x30 L4-2 (attribute) | | | +--> 0x04 L5-2 type | +--> 0x31 L6-2 (values) | | | +--> 0x04 L7-2-1 value | +--> ... | +--> 0x04 L7-2-n value | +--> ... | +--> 0x30 L4-m (attribute) | +--> 0x04 L5-m type +--> 0x31 L6-m (values) | +--> 0x04 L7-m-1 value +--> ... +--> 0x04 L7-m-n value
- Specified by:
computeLength
in interfaceAsn1Object
- Returns:
- The object's computed length
-
encode
public ByteBuffer encode(ByteBuffer buffer) throws EncoderException
Encode the AddRequest message to a PDU.
AddRequest :0x68 LL 0x04 LL entry 0x30 LL attributesList 0x30 LL attributeList 0x04 LL attributeDescription 0x31 LL attributeValues 0x04 LL attributeValue ... 0x04 LL attributeValue ... 0x30 LL attributeList 0x04 LL attributeDescription 0x31 LL attributeValue 0x04 LL attributeValue ... 0x04 LL attributeValue
- Specified by:
encode
in interfaceAsn1Object
- Parameters:
buffer
- The buffer where to put the PDU- Returns:
- The encoded PDU.
- Throws:
EncoderException
- if the buffer can't be encoded
-
-