org.apache.directory.api.ldap.codec.api
Class ExtendedRequestDecorator<Q extends ExtendedRequest<P>,P extends ExtendedResponse>

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<Q,P>
                  extended by org.apache.directory.api.ldap.codec.api.ExtendedRequestDecorator<Q,P>
All Implemented Interfaces:
Decorator<Q>, AbandonableRequest, ExtendedRequest<P>, Message, Request, ResultResponseRequest<P>, SingleReplyRequest<P>
Direct Known Subclasses:
CancelRequestDecorator, CertGenerationRequestDecorator, GracefulShutdownRequestDecorator, StoredProcedureRequestDecorator

public class ExtendedRequestDecorator<Q extends ExtendedRequest<P>,P extends ExtendedResponse>
extends SingleReplyRequestDecorator<Q,P>
implements ExtendedRequest<P>

A decorator for the ExtendedRequest message

Author:
Apache Directory Project

Field Summary
protected  byte[] requestValue
           
 
Fields inherited from class org.apache.directory.api.ldap.codec.api.MessageDecorator
messageLength
 
Fields inherited from interface org.apache.directory.api.ldap.model.message.ExtendedRequest
RESP_TYPE, TYPE
 
Constructor Summary
ExtendedRequestDecorator(LdapApiService codec, Q decoratedMessage)
          Makes a ExtendedRequest a MessageDecorator.
 
Method Summary
 ExtendedRequest<P> addAllControls(Control[] controls)
          Adds an array of controls to this Message.
 ExtendedRequest<P> addControl(Control control)
          Adds a control to this Message.
 int computeLength()
          Compute the ExtendedRequest length ExtendedRequest : 0x77 L1 | +--> 0x80 L2 name [+--> 0x81 L3 value] L1 = Length(0x80) + Length(L2) + L2 [+ Length(0x81) + Length(L3) + L3] Length(ExtendedRequest) = Length(0x77) + Length(L1) + L1
 ByteBuffer encode(ByteBuffer buffer)
          Encode the ExtendedRequest message to a PDU.
 int getExtendedRequestLength()
           
 String getRequestName()
          Gets the Object Identifier corresponding to the extended request type.
 byte[] getRequestNameBytes()
          Gets the requestName bytes.
 byte[] getRequestValue()
          
 ExtendedRequest<P> removeControl(Control control)
          Deletes a control removing it from this Message.
 void setExtendedRequestLength(int extendedRequestLength)
          Stores the encoded length for the ExtendedRequest
 ExtendedRequest<P> setMessageId(int messageId)
          Sets the Message ID for this request
 ExtendedRequest<P> setRequestName(String oid)
          Sets the Object Identifier corresponding to the extended request type.
 void setRequestNameBytes(byte[] requestNameBytes)
          Sets the requestName bytes.
 void setRequestValue(byte[] requestValue)
          
 
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
 

Field Detail

requestValue

protected byte[] requestValue
Constructor Detail

ExtendedRequestDecorator

public ExtendedRequestDecorator(LdapApiService codec,
                                Q decoratedMessage)
Makes a ExtendedRequest a MessageDecorator.

Parameters:
decoratedMessage - the decorated ExtendedRequest
Method Detail

setExtendedRequestLength

public void setExtendedRequestLength(int extendedRequestLength)
Stores the encoded length for the ExtendedRequest

Parameters:
extendedRequestLength - The encoded length

getExtendedRequestLength

public int getExtendedRequestLength()
Returns:
The encoded ExtendedRequest's length

getRequestNameBytes

public byte[] getRequestNameBytes()
Gets the requestName bytes.

Returns:
the requestName bytes of the extended request type.

setRequestNameBytes

public void setRequestNameBytes(byte[] requestNameBytes)
Sets the requestName bytes.

Parameters:
requestNameBytes - the OID bytes of the extended request type.

getRequestName

public String getRequestName()
Gets the Object Identifier corresponding to the extended request type. This is the requestName portion of the ExtendedRequst PDU.

Specified by:
getRequestName in interface ExtendedRequest<P extends ExtendedResponse>
Returns:
the dotted-decimal representation as a String of the OID

setRequestName

public ExtendedRequest<P> setRequestName(String oid)
Sets the Object Identifier corresponding to the extended request type.

Specified by:
setRequestName in interface ExtendedRequest<P extends ExtendedResponse>
Parameters:
oid - the dotted-decimal representation as a String of the OID
Returns:
The ExtendedRequest instance

getRequestValue

public byte[] getRequestValue()


setRequestValue

public void setRequestValue(byte[] requestValue)


setMessageId

public ExtendedRequest<P> setMessageId(int messageId)
Sets the Message ID for this request

Specified by:
setMessageId in interface ExtendedRequest<P extends ExtendedResponse>
Specified by:
setMessageId in interface Message
Overrides:
setMessageId in class MessageDecorator<Q extends ExtendedRequest<P>>
Parameters:
messageId - The message Id
Returns:
A Message reference

addControl

public ExtendedRequest<P> addControl(Control control)
                                                       throws MessageException
Adds a control to this Message.

Specified by:
addControl in interface ExtendedRequest<P extends ExtendedResponse>
Specified by:
addControl in interface Message
Overrides:
addControl in class MessageDecorator<Q extends ExtendedRequest<P>>
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 ExtendedRequest<P> addAllControls(Control[] controls)
                                                           throws MessageException
Adds an array of controls to this Message.

Specified by:
addAllControls in interface ExtendedRequest<P extends ExtendedResponse>
Specified by:
addAllControls in interface Message
Overrides:
addAllControls in class MessageDecorator<Q extends ExtendedRequest<P>>
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 ExtendedRequest<P> removeControl(Control control)
                                                          throws MessageException
Deletes a control removing it from this Message.

Specified by:
removeControl in interface ExtendedRequest<P extends ExtendedResponse>
Specified by:
removeControl in interface Message
Overrides:
removeControl in class MessageDecorator<Q extends ExtendedRequest<P>>
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 ExtendedRequest length ExtendedRequest : 0x77 L1 | +--> 0x80 L2 name [+--> 0x81 L3 value] L1 = Length(0x80) + Length(L2) + L2 [+ Length(0x81) + Length(L3) + L3] Length(ExtendedRequest) = Length(0x77) + Length(L1) + L1

Specified by:
computeLength in interface Decorator<Q extends ExtendedRequest<P>>
Returns:
The object's computed length

encode

public ByteBuffer encode(ByteBuffer buffer)
                  throws EncoderException
Encode the ExtendedRequest message to a PDU. ExtendedRequest : 0x80 LL resquest name [0x81 LL request value]

Specified by:
encode in interface Decorator<Q extends ExtendedRequest<P>>
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.