org.apache.directory.api.ldap.codec.decorators
Class CompareRequestDecorator

java.lang.Object
  extended by org.apache.directory.api.ldap.codec.api.MessageDecorator<M>
      extended by org.apache.directory.api.ldap.codec.decorators.RequestDecorator<M>
          extended by org.apache.directory.api.ldap.codec.decorators.ResultResponseRequestDecorator<M,R>
              extended by org.apache.directory.api.ldap.codec.decorators.SingleReplyRequestDecorator<CompareRequest,CompareResponse>
                  extended by org.apache.directory.api.ldap.codec.decorators.CompareRequestDecorator
All Implemented Interfaces:
Decorator<CompareRequest>, AbandonableRequest, CompareRequest, Message, Request, ResultResponseRequest<CompareResponse>, SingleReplyRequest<CompareResponse>

public class CompareRequestDecorator
extends SingleReplyRequestDecorator<CompareRequest,CompareResponse>
implements CompareRequest

A decorator for the CompareRequest message

Author:
Apache Directory Project

Field Summary
 
Fields inherited from class org.apache.directory.api.ldap.codec.api.MessageDecorator
messageLength
 
Fields inherited from interface org.apache.directory.api.ldap.model.message.CompareRequest
RESP_TYPE, TYPE
 
Constructor Summary
CompareRequestDecorator(LdapApiService codec, CompareRequest decoratedMessage)
          Makes a CompareRequest a MessageDecorator.
 
Method Summary
 CompareRequest addAllControls(Control[] controls)
          Adds an array of controls to this Message.
 CompareRequest addControl(Control control)
          Adds a control to this Message.
 int computeLength()
          Compute the CompareRequest length CompareRequest : 0x6E L1 | +--> 0x04 L2 entry +--> 0x30 L3 (ava) | +--> 0x04 L4 attributeDesc +--> 0x04 L5 assertionValue L3 = Length(0x04) + Length(L4) + L4 + Length(0x04) + Length(L5) + L5 Length(CompareRequest) = Length(0x6E) + Length(L1) + L1 + Length(0x04) + Length(L2) + L2 + Length(0x30) + Length(L3) + L3
 ByteBuffer encode(ByteBuffer buffer)
          Encode the CompareRequest message to a PDU.
 Value<?> getAssertionValue()
          Gets the attribute value to use in making the comparison.
 String getAttributeId()
          Gets the attribute id use in making the comparison.
 byte[] getAttrIdBytes()
          Gets the attribute id bytes use in making the comparison.
 byte[] getAttrValBytes()
          Gets the attribute value bytes use in making the comparison.
 int getAvaLength()
           
 int getCompareRequestLength()
           
 Dn getName()
          Gets the distinguished name of the entry to be compared using the attribute value assertion.
 CompareRequest removeControl(Control control)
          Deletes a control removing it from this Message.
 CompareRequest setAssertionValue(byte[] value)
          Sets the attribute value to use in the comparison.
 CompareRequest setAssertionValue(String value)
          Sets the attribute value to use in the comparison.
 CompareRequest setAttributeId(String attrId)
          Sets the attribute id used in the comparison.
 void setAttrIdBytes(byte[] attrIdBytes)
          Sets the attribute id bytes used in the comparison.
 void setAttrValBytes(byte[] attrValBytes)
          Sets the attribute value bytes used in the comparison.
 void setAvaLength(int avaLength)
          Stores the encoded length for the ava
 void setCompareRequestLength(int compareRequestLength)
          Stores the encoded length for the CompareRequest
 CompareRequest setMessageId(int messageId)
          Sets the Message ID for this request
 CompareRequest setName(Dn name)
          Sets the distinguished name of the entry to be compared using the attribute value assertion.
 
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.directory.api.ldap.model.message.SingleReplyRequest
getResponseType
 
Methods inherited from interface org.apache.directory.api.ldap.model.message.ResultResponseRequest
getResultResponse
 
Methods inherited from interface org.apache.directory.api.ldap.model.message.Request
hasResponse
 
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.AbandonableRequest
abandon, addAbandonListener, isAbandoned
 

Constructor Detail

CompareRequestDecorator

public CompareRequestDecorator(LdapApiService codec,
                               CompareRequest decoratedMessage)
Makes a CompareRequest a MessageDecorator.

Parameters:
decoratedMessage - the decorated CompareRequest
Method Detail

setCompareRequestLength

public void setCompareRequestLength(int compareRequestLength)
Stores the encoded length for the CompareRequest

Parameters:
compareRequestLength - The encoded length

getCompareRequestLength

public int getCompareRequestLength()
Returns:
The encoded CompareRequest length

setAvaLength

public void setAvaLength(int avaLength)
Stores the encoded length for the ava

Parameters:
avaLength - The encoded length

getAvaLength

public int getAvaLength()
Returns:
The encoded ava length

getAttrIdBytes

public byte[] getAttrIdBytes()
Gets the attribute id bytes use in making the comparison.

Returns:
the attribute id bytes used in comparison.

setAttrIdBytes

public void setAttrIdBytes(byte[] attrIdBytes)
Sets the attribute id bytes used in the comparison.

Parameters:
attrIdBytes - the attribute id bytes used in comparison.

getAttrValBytes

public byte[] getAttrValBytes()
Gets the attribute value bytes use in making the comparison.

Returns:
the attribute value bytes used in comparison.

setAttrValBytes

public void setAttrValBytes(byte[] attrValBytes)
Sets the attribute value bytes used in the comparison.

Parameters:
attrValBytes - the attribute value bytes used in comparison.

getName

public Dn getName()
Gets the distinguished name of the entry to be compared using the attribute value assertion.

Specified by:
getName in interface CompareRequest
Returns:
the Dn of the compared entry.

setName

public CompareRequest setName(Dn name)
Sets the distinguished name of the entry to be compared using the attribute value assertion.

Specified by:
setName in interface CompareRequest
Parameters:
name - the Dn of the compared entry.
Returns:
The CompareRequest instance

getAssertionValue

public Value<?> getAssertionValue()
Gets the attribute value to use in making the comparison.

Specified by:
getAssertionValue in interface CompareRequest
Returns:
the attribute value to used in comparison.

setAssertionValue

public CompareRequest setAssertionValue(String value)
Sets the attribute value to use in the comparison.

Specified by:
setAssertionValue in interface CompareRequest
Parameters:
value - the attribute value used in comparison.
Returns:
The CompareRequest instance

setAssertionValue

public CompareRequest setAssertionValue(byte[] value)
Sets the attribute value to use in the comparison.

Specified by:
setAssertionValue in interface CompareRequest
Parameters:
value - the attribute value used in comparison.
Returns:
The CompareRequest instance

getAttributeId

public String getAttributeId()
Gets the attribute id use in making the comparison.

Specified by:
getAttributeId in interface CompareRequest
Returns:
the attribute id used in comparison.

setAttributeId

public CompareRequest setAttributeId(String attrId)
Sets the attribute id used in the comparison.

Specified by:
setAttributeId in interface CompareRequest
Parameters:
attrId - the attribute id used in comparison.
Returns:
The CompareRequest instance

setMessageId

public CompareRequest setMessageId(int messageId)
Sets the Message ID for this request

Specified by:
setMessageId in interface CompareRequest
Specified by:
setMessageId in interface Message
Overrides:
setMessageId in class MessageDecorator<CompareRequest>
Parameters:
messageId - The message Id
Returns:
A Message reference

addControl

public CompareRequest addControl(Control control)
                          throws MessageException
Adds a control to this Message.

Specified by:
addControl in interface CompareRequest
Specified by:
addControl in interface Message
Overrides:
addControl in class MessageDecorator<CompareRequest>
Parameters:
control - the control to add.
Returns:
A Message reference
Throws:
MessageException - if controls cannot be added to this Message or the control is not known etc.

addAllControls

public CompareRequest addAllControls(Control[] controls)
                              throws MessageException
Adds an array of controls to this Message.

Specified by:
addAllControls in interface CompareRequest
Specified by:
addAllControls in interface Message
Overrides:
addAllControls in class MessageDecorator<CompareRequest>
Parameters:
controls - the controls to add.
Returns:
A Message reference
Throws:
MessageException - if controls cannot be added to this Message or they are not known etc.

removeControl

public CompareRequest removeControl(Control control)
                             throws MessageException
Deletes a control removing it from this Message.

Specified by:
removeControl in interface CompareRequest
Specified by:
removeControl in interface Message
Overrides:
removeControl in class MessageDecorator<CompareRequest>
Parameters:
control - the control to remove.
Returns:
A Message reference
Throws:
MessageException - if controls cannot be added to this Message or the control is not known etc.

computeLength

public int computeLength()
Compute the CompareRequest length CompareRequest : 0x6E L1 | +--> 0x04 L2 entry +--> 0x30 L3 (ava) | +--> 0x04 L4 attributeDesc +--> 0x04 L5 assertionValue L3 = Length(0x04) + Length(L4) + L4 + Length(0x04) + Length(L5) + L5 Length(CompareRequest) = Length(0x6E) + Length(L1) + L1 + Length(0x04) + Length(L2) + L2 + Length(0x30) + Length(L3) + L3

Specified by:
computeLength in interface Decorator<CompareRequest>
Returns:
The CompareRequest PDU's length

encode

public ByteBuffer encode(ByteBuffer buffer)
                  throws EncoderException
Encode the CompareRequest message to a PDU. CompareRequest : 0x6E LL 0x04 LL entry 0x30 LL attributeValueAssertion 0x04 LL attributeDesc 0x04 LL assertionValue

Specified by:
encode in interface Decorator<CompareRequest>
Parameters:
buffer - The buffer where to put the PDU
Returns:
The PDU.
Throws:
EncoderException - if the buffer can't be encoded


Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.