com.unboundid.ldap.protocol
Class GenericResponseProtocolOp

java.lang.Object
  extended by com.unboundid.ldap.protocol.GenericResponseProtocolOp
All Implemented Interfaces:
ProtocolOp, java.io.Serializable
Direct Known Subclasses:
AddResponseProtocolOp, CompareResponseProtocolOp, DeleteResponseProtocolOp, ModifyDNResponseProtocolOp, ModifyResponseProtocolOp, SearchResultDoneProtocolOp

@InternalUseOnly
@NotExtensible
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public abstract class GenericResponseProtocolOp
extends java.lang.Object
implements ProtocolOp

This class provides an implementation of a generic response protocol op. It must be subclassed by classes providing implementations for each operation type.

See Also:
Serialized Form

Field Summary
static byte TYPE_REFERRALS
          The BER type for the referral URLs elements.
 
Constructor Summary
protected GenericResponseProtocolOp(ASN1StreamReader reader)
          Creates a new response read from the provided ASN.1 stream reader.
protected GenericResponseProtocolOp(byte type, int resultCode, java.lang.String matchedDN, java.lang.String diagnosticMessage, java.util.List<java.lang.String> referralURLs)
          Creates a new instance of this response with the provided information.
 
Method Summary
 java.lang.String getDiagnosticMessage()
          Retrieves the diagnostic message for this response, if any.
 java.lang.String getMatchedDN()
          Retrieves the matched DN for this response, if any.
 byte getProtocolOpType()
          Retrieves the BER type for this protocol op.
 java.util.List<java.lang.String> getReferralURLs()
          Retrieves the list of referral URLs for this response.
 int getResultCode()
          Retrieves the result code for this response.
 LDAPResult toLDAPResult(Control... controls)
          Creates a new LDAP result object from this response protocol op.
 java.lang.String toString()
          Retrieves a string representation of this protocol op.
 void toString(java.lang.StringBuilder buffer)
          Appends a string representation of this LDAP protocol op to the provided buffer.
 void writeTo(ASN1Buffer buffer)
          Writes an ASN.1-encoded representation of this LDAP protocol op to the provided ASN.1 buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.unboundid.ldap.protocol.ProtocolOp
encodeProtocolOp
 

Field Detail

TYPE_REFERRALS

public static final byte TYPE_REFERRALS
The BER type for the referral URLs elements.

See Also:
Constant Field Values
Constructor Detail

GenericResponseProtocolOp

protected GenericResponseProtocolOp(byte type,
                                    int resultCode,
                                    java.lang.String matchedDN,
                                    java.lang.String diagnosticMessage,
                                    java.util.List<java.lang.String> referralURLs)
Creates a new instance of this response with the provided information.

Parameters:
type - The BER type for this response.
resultCode - The result code for this response.
matchedDN - The matched DN for this result, if available.
diagnosticMessage - The diagnostic message for this response, if available.
referralURLs - The list of referral URLs for this response, if available.

GenericResponseProtocolOp

protected GenericResponseProtocolOp(ASN1StreamReader reader)
                             throws LDAPException
Creates a new response read from the provided ASN.1 stream reader.

Parameters:
reader - The ASN.1 stream reader from which to read the response.
Throws:
LDAPException - If a problem occurs while reading or parsing the response.
Method Detail

getResultCode

public final int getResultCode()
Retrieves the result code for this response.

Returns:
The result code for this response.

getMatchedDN

public final java.lang.String getMatchedDN()
Retrieves the matched DN for this response, if any.

Returns:
The matched DN for this response, or null if there is no matched DN.

getDiagnosticMessage

public final java.lang.String getDiagnosticMessage()
Retrieves the diagnostic message for this response, if any.

Returns:
The diagnostic message for this response, or null if there is no diagnostic message.

getReferralURLs

public final java.util.List<java.lang.String> getReferralURLs()
Retrieves the list of referral URLs for this response.

Returns:
The list of referral URLs for this response, or an empty list if there are no referral URLs.

getProtocolOpType

public byte getProtocolOpType()
Retrieves the BER type for this protocol op.

Specified by:
getProtocolOpType in interface ProtocolOp
Returns:
The BER type for this protocol op.

writeTo

public final void writeTo(ASN1Buffer buffer)
Writes an ASN.1-encoded representation of this LDAP protocol op to the provided ASN.1 buffer. This method is intended for internal use only and should not be used by third-party code.

Specified by:
writeTo in interface ProtocolOp
Parameters:
buffer - The ASN.1 buffer to which the encoded representation should be written.

toLDAPResult

public LDAPResult toLDAPResult(Control... controls)
Creates a new LDAP result object from this response protocol op.

Parameters:
controls - The set of controls to include in the LDAP result. It may be empty or null if no controls should be included.
Returns:
The LDAP result that was created.

toString

public final java.lang.String toString()
Retrieves a string representation of this protocol op.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of this protocol op.

toString

public final void toString(java.lang.StringBuilder buffer)
Appends a string representation of this LDAP protocol op to the provided buffer.

Specified by:
toString in interface ProtocolOp
Parameters:
buffer - The buffer to which the string representation should be appended.