org.apache.directory.shared.dsmlv2.reponse
Class ErrorResponse

java.lang.Object
  extended by org.apache.directory.shared.asn1.AbstractAsn1Object
      extended by org.apache.directory.shared.ldap.codec.LdapMessageCodec
          extended by org.apache.directory.shared.ldap.codec.LdapResponseCodec
              extended by org.apache.directory.shared.dsmlv2.reponse.ErrorResponse
All Implemented Interfaces:
Asn1Object, DsmlDecorator

public class ErrorResponse
extends LdapResponseCodec
implements DsmlDecorator

Class representing Error Response.

An Error Response has a requestID, a message, and a type which can be :

Version:
$Rev$, $Date$
Author:
Apache Directory Project

Nested Class Summary
static class ErrorResponse.ErrorResponseType
          This enum represents the different types of error response
 
Field Summary
 
Fields inherited from class org.apache.directory.shared.ldap.codec.LdapMessageCodec
ldapMessageLength
 
Fields inherited from class org.apache.directory.shared.asn1.AbstractAsn1Object
parent
 
Constructor Summary
ErrorResponse()
          Creates a new instance of ErrorResponse.
ErrorResponse(int requestID, ErrorResponse.ErrorResponseType type, java.lang.String message)
          Creates a new instance of ErrorResponse.
 
Method Summary
protected  int computeLengthProtocolOp()
           
protected  void encodeProtocolOp(java.nio.ByteBuffer buffer)
           
 java.lang.String getMessage()
          Gets the message
 MessageTypeEnum getMessageType()
          Get the message type
 java.lang.String getMessageTypeName()
          Get the message type Name
 int getRequestID()
          Gets the request ID
 ErrorResponse.ErrorResponseType getType()
          Gets the type of error response
 java.lang.String getTypeDescr(ErrorResponse.ErrorResponseType type)
          Returns the String associated to the error response type
 void setMessage(java.lang.String message)
          Sets the message
 void setRequestID(int requestID)
          Sets the request ID
 void setType(ErrorResponse.ErrorResponseType type)
          Sets the type of error response
 org.dom4j.Element toDsml(org.dom4j.Element root)
          Converts the request/reponse to its XML representation in the DSMLv2 format
 
Methods inherited from class org.apache.directory.shared.ldap.codec.LdapResponseCodec
computeLdapResultLength, encode, getLdapResponseLength, getLdapResult, setLdapResult, toString
 
Methods inherited from class org.apache.directory.shared.ldap.codec.LdapMessageCodec
addControl, addControls, computeLength, encode, getCodecControl, getControls, getControls, getCurrentControl, getMessageId, initControls, setMessageId, toString
 
Methods inherited from class org.apache.directory.shared.asn1.AbstractAsn1Object
addLength, getCurrentLength, getExpectedLength, getParent, getTlvId, setCurrentLength, setExpectedLength, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ErrorResponse

public ErrorResponse()
Creates a new instance of ErrorResponse.


ErrorResponse

public ErrorResponse(int requestID,
                     ErrorResponse.ErrorResponseType type,
                     java.lang.String message)
Creates a new instance of ErrorResponse.

Parameters:
requestID - the requestID of the response
type - the type of the response
message - the associated message
Method Detail

toDsml

public org.dom4j.Element toDsml(org.dom4j.Element root)
Description copied from interface: DsmlDecorator
Converts the request/reponse to its XML representation in the DSMLv2 format

Specified by:
toDsml in interface DsmlDecorator
Parameters:
root - the root dom4j Element
Returns:
the dom4j Element corresponding to the entry.

getTypeDescr

public java.lang.String getTypeDescr(ErrorResponse.ErrorResponseType type)
Returns the String associated to the error response type

Parameters:
type - the error response type
Returns:
the corresponding String

getMessage

public java.lang.String getMessage()
Gets the message

Returns:
the message

setMessage

public void setMessage(java.lang.String message)
Sets the message

Parameters:
message - the message to set

getRequestID

public int getRequestID()
Gets the request ID

Returns:
the request ID

setRequestID

public void setRequestID(int requestID)
Sets the request ID

Parameters:
requestID - the request ID to set

getType

public ErrorResponse.ErrorResponseType getType()
Gets the type of error response

Returns:
the type of error response

setType

public void setType(ErrorResponse.ErrorResponseType type)
Sets the type of error response

Parameters:
type - the type of error response to set

computeLengthProtocolOp

protected int computeLengthProtocolOp()
Specified by:
computeLengthProtocolOp in class LdapMessageCodec

encodeProtocolOp

protected void encodeProtocolOp(java.nio.ByteBuffer buffer)
                         throws EncoderException
Specified by:
encodeProtocolOp in class LdapMessageCodec
Throws:
EncoderException

getMessageType

public MessageTypeEnum getMessageType()
Description copied from class: LdapMessageCodec
Get the message type

Specified by:
getMessageType in class LdapMessageCodec
Returns:
The message type

getMessageTypeName

public java.lang.String getMessageTypeName()
Description copied from class: LdapMessageCodec
Get the message type Name

Specified by:
getMessageTypeName in class LdapMessageCodec
Returns:
The message type name


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.