com.slamd.tools.ldapdecoder.protocol
Class AddResponse

java.lang.Object
  extended by com.slamd.tools.ldapdecoder.protocol.ProtocolOp
      extended by com.slamd.tools.ldapdecoder.protocol.AddResponse

public class AddResponse
extends ProtocolOp

This class defines an LDAP add response, which provides information about the result of processing an add request.

Author:
Neil A. Wilson

Field Summary
 
Fields inherited from class com.slamd.tools.ldapdecoder.protocol.ProtocolOp
ABANDON_REQUEST_TYPE, ADD_REQUEST_TYPE, ADD_RESPONSE_TYPE, BIND_REQUEST_TYPE, BIND_RESPONSE_TYPE, COMPARE_REQUEST_TYPE, COMPARE_RESPONSE_TYPE, DELETE_REQUEST_TYPE, DELETE_RESPONSE_TYPE, EXTENDED_REQUEST_TYPE, EXTENDED_RESPONSE_TYPE, MODIFY_DN_REQUEST_TYPE, MODIFY_DN_RESPONSE_TYPE, MODIFY_REQUEST_TYPE, MODIFY_RESPONSE_TYPE, REFERRAL_TYPE, SEARCH_REQUEST_TYPE, SEARCH_RESULT_DONE_TYPE, SEARCH_RESULT_ENTRY_TYPE, SEARCH_RESULT_REFERENCE_TYPE, UNBIND_REQUEST_TYPE
 
Constructor Summary
AddResponse(int resultCode, java.lang.String matchedDN, java.lang.String errorMessage)
          Creates a new add response protocol op with the provided information.
AddResponse(int resultCode, java.lang.String matchedDN, java.lang.String errorMessage, java.lang.String[] referrals)
          Creates a new add response protocol op with the provided information.
 
Method Summary
static AddResponse decodeAddResponse(ASN1Element element)
          Decodes the provided ASN.1 element as an add response protocol op.
 ASN1Element encode()
          Encodes this protocol op to an ASN.1 element.
 java.lang.String getErrorMessage()
          Retrieves the error message for this result.
 java.lang.String getMatchedDN()
          Retrieves the matched DN for this result.
 java.lang.String getProtocolOpType()
          Retrieves a user-friendly name for this protocol op.
 java.lang.String[] getReferrals()
          Retrieves the set of referrals for this result.
 int getResultCode()
          Retrieves the result code for the operation.
 void toSLAMDScript(java.io.PrintStream scriptWriter)
          Constructs a string representation of this LDAP message in a form that can be written to a SLAMD script.
 java.lang.String toString(int indent)
          Retrieves a string representation of this protocol op with the specified indent.
 
Methods inherited from class com.slamd.tools.ldapdecoder.protocol.ProtocolOp
decode, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AddResponse

public AddResponse(int resultCode,
                   java.lang.String matchedDN,
                   java.lang.String errorMessage)
Creates a new add response protocol op with the provided information.

Parameters:
resultCode - The result code for this response.
matchedDN - The matched DN for this response.
errorMessage - The error message for this response.

AddResponse

public AddResponse(int resultCode,
                   java.lang.String matchedDN,
                   java.lang.String errorMessage,
                   java.lang.String[] referrals)
Creates a new add response protocol op with the provided information.

Parameters:
resultCode - The result code for this response.
matchedDN - The matched DN for this response.
errorMessage - The error message for this response.
referrals - The set of referrals for this response.
Method Detail

getResultCode

public int getResultCode()
Retrieves the result code for the operation.

Returns:
The result code for the operation.

getErrorMessage

public java.lang.String getErrorMessage()
Retrieves the error message for this result.

Returns:
The error message for this result.

getMatchedDN

public java.lang.String getMatchedDN()
Retrieves the matched DN for this result.

Returns:
The matched DN for this result.

getReferrals

public java.lang.String[] getReferrals()
Retrieves the set of referrals for this result.

Returns:
The set of referrals for this result, or null if there were no referrals contained in the result.

encode

public ASN1Element encode()
Encodes this protocol op to an ASN.1 element.

Specified by:
encode in class ProtocolOp
Returns:
The ASN.1 element containing the encoded protocol op.

decodeAddResponse

public static AddResponse decodeAddResponse(ASN1Element element)
                                     throws ProtocolException
Decodes the provided ASN.1 element as an add response protocol op.

Parameters:
element - The ASN.1 element to be decoded.
Returns:
The decoded add response.
Throws:
ProtocolException - If a problem occurs while decoding the provided ASN.1 element as an add response.

getProtocolOpType

public java.lang.String getProtocolOpType()
Retrieves a user-friendly name for this protocol op.

Specified by:
getProtocolOpType in class ProtocolOp
Returns:
A user-friendly name for this protocol op.

toString

public java.lang.String toString(int indent)
Retrieves a string representation of this protocol op with the specified indent.

Specified by:
toString in class ProtocolOp
Parameters:
indent - The number of spaces to indent the output.
Returns:
A string representation of this protocol op with the specified indent.

toSLAMDScript

public void toSLAMDScript(java.io.PrintStream scriptWriter)
Constructs a string representation of this LDAP message in a form that can be written to a SLAMD script. It may be empty if this message isn't one that would be generated as part of a client request.

Specified by:
toSLAMDScript in class ProtocolOp
Parameters:
scriptWriter - The print stream to which the script contents should be written.