All LDAP Classes
Internal LDAP Classes

com.novell.ldap
Class LDAPResponse

java.lang.Object
  extended by com.novell.ldap.LDAPMessage
      extended by com.novell.ldap.LDAPResponse
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable
Direct Known Subclasses:
LDAPExtendedResponse, LDAPIntermediateResponse

public class LDAPResponse
extends LDAPMessage

A message received from an LDAPServer in response to an asynchronous request.

Sample Code: Searchas.java

See Also:
LDAPConnection.search(java.lang.String, int, java.lang.String, java.lang.String[], boolean), Serialized Form

Field Summary
private  ReferralInfo activeReferral
           
private  InterThreadException exception
           
 
Fields inherited from class com.novell.ldap.LDAPMessage
ABANDON_REQUEST, ADD_REQUEST, ADD_RESPONSE, BIND_REQUEST, BIND_RESPONSE, COMPARE_REQUEST, COMPARE_RESPONSE, DEL_REQUEST, DEL_RESPONSE, EXTENDED_REQUEST, EXTENDED_RESPONSE, INTERMEDIATE_RESPONSE, message, MODIFY_RDN_REQUEST, MODIFY_RDN_RESPONSE, MODIFY_REQUEST, MODIFY_RESPONSE, SEARCH_REQUEST, SEARCH_RESPONSE, SEARCH_RESULT, SEARCH_RESULT_REFERENCE, UNBIND_REQUEST
 
Constructor Summary
LDAPResponse()
          This constructor was added to support default Serialization
LDAPResponse(int type)
          Creates a SUCCESS response LDAPMessage.
LDAPResponse(InterThreadException ex, ReferralInfo activeReferral)
          Creates an LDAPResponse using an LDAPException.
LDAPResponse(int type, int resultCode, java.lang.String matchedDN, java.lang.String serverMessage, java.lang.String[] referrals, LDAPControl[] controls)
          Creates a response LDAPMessage from parameters.
LDAPResponse(RfcLDAPMessage message)
          Creates a response LDAPMessage when receiving an asynchronous response from a server.
 
Method Summary
 void chkResultCode()
          Checks the resultCode and throws the appropriate exception.
(package private)  ReferralInfo getActiveReferral()
          Indicates the referral instance being followed if the connection created to follow referrals.
 LDAPControl[] getControls()
          Returns any controls in the message.
 java.lang.String getErrorMessage()
          Returns any error message in the response.
(package private)  LDAPException getException()
          Returns an embedded exception response
 java.lang.String getMatchedDN()
          Returns the partially matched DN field from the server response, if the response contains one.
 int getMessageID()
          Returns the message ID.
 java.lang.String[] getReferrals()
          Returns all referrals in a server response, if the response contains any.
 int getResultCode()
          Returns the result code in a server response.
(package private)  LDAPException getResultException()
          Checks the resultCode and generates the appropriate exception or null if success.
 int getType()
          Returns the LDAP operation type of the message.
(package private)  boolean hasException()
          Indicates if this response is an embedded exception response
private static RfcControls RfcControlFactory(LDAPControl[] controls)
          Converts a LDAPControl array to an RfcControl Structure.
private static ASN1Sequence RfcResultFactory(int type, int resultCode, java.lang.String matchedDN, java.lang.String serverMessage, java.lang.String[] referrals)
           
protected  void setDeserializedValues(LDAPMessage readObject, RfcControls asn1Ctrls)
           
 
Methods inherited from class com.novell.ldap.LDAPMessage
clone, getASN1Object, getRequestingMessage, getTag, isRequest, readDSML, readExternal, setTag, toString, writeDSML, writeExternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

exception

private InterThreadException exception

activeReferral

private ReferralInfo activeReferral
Constructor Detail

LDAPResponse

public LDAPResponse()
This constructor was added to support default Serialization


LDAPResponse

public LDAPResponse(InterThreadException ex,
                    ReferralInfo activeReferral)
Creates an LDAPResponse using an LDAPException. Used to wake up the user following an abandon. Note: The abandon doesn't have to be user initiated but may be the result of error conditions.
Referral information is available if this connection created solely to follow a referral.

Parameters:
ex - The exception

activeReferral - The referral actually used to create the connection

LDAPResponse

LDAPResponse(RfcLDAPMessage message)
Creates a response LDAPMessage when receiving an asynchronous response from a server.

Parameters:
message - The RfcLDAPMessage from a server.

LDAPResponse

public LDAPResponse(int type)
Creates a SUCCESS response LDAPMessage. Typically the response comes from a source other than a BER encoded LDAP message, such as from DSML. Other values which are allowed in a response are set to their empty values.

Parameters:
type - The message type as defined in LDAPMessage.
See Also:
LDAPMessage

LDAPResponse

public LDAPResponse(int type,
                    int resultCode,
                    java.lang.String matchedDN,
                    java.lang.String serverMessage,
                    java.lang.String[] referrals,
                    LDAPControl[] controls)
Creates a response LDAPMessage from parameters. Typically the data comes from a source other than a BER encoded LDAP message, such as from DSML.

Parameters:
type - The message type as defined in LDAPMessage.
resultCode - The result code as defined in LDAPException.
matchedDN - The name of the lowest entry that was matched for some error result codes, an empty string or null if none.
serverMessage - A diagnostic message returned by the server, an empty string or null if none.
referrals - The referral URLs returned for a REFERRAL result code or null if none.
controls - Any controls returned by the server or null if none.
See Also:
LDAPMessage, LDAPException
Method Detail

RfcControlFactory

private static RfcControls RfcControlFactory(LDAPControl[] controls)
Converts a LDAPControl array to an RfcControl Structure.

Parameters:
controls - array of LDAPControl
Returns:
RfcControls Structure representation of controls arrray.

RfcResultFactory

private static ASN1Sequence RfcResultFactory(int type,
                                             int resultCode,
                                             java.lang.String matchedDN,
                                             java.lang.String serverMessage,
                                             java.lang.String[] referrals)

getErrorMessage

public java.lang.String getErrorMessage()
Returns any error message in the response.

Returns:
Any error message in the response.

getMatchedDN

public java.lang.String getMatchedDN()
Returns the partially matched DN field from the server response, if the response contains one.

Returns:
The partially matched DN field, if the response contains one.

getReferrals

public java.lang.String[] getReferrals()
Returns all referrals in a server response, if the response contains any.

Returns:
All the referrals in the server response.

getResultCode

public int getResultCode()
Returns the result code in a server response.

For a list of result codes, see the LDAPException class.

Returns:
The result code.

chkResultCode

public void chkResultCode()
                   throws LDAPException
Checks the resultCode and throws the appropriate exception.

Throws:
LDAPException - A general exception which includes an error message and an LDAP error code.

getResultException

LDAPException getResultException()
Checks the resultCode and generates the appropriate exception or null if success.


getControls

public LDAPControl[] getControls()
Returns any controls in the message.

Overrides:
getControls in class LDAPMessage
See Also:
LDAPMessage.getControls()

getMessageID

public int getMessageID()
Returns the message ID.

Overrides:
getMessageID in class LDAPMessage
See Also:
LDAPMessage.getMessageID()

getType

public int getType()
Returns the LDAP operation type of the message.

Overrides:
getType in class LDAPMessage
Returns:
The operation type of the message.
See Also:
LDAPMessage.getType()

hasException

boolean hasException()
Indicates if this response is an embedded exception response

Returns:
true if contains an embedded LDAPexception

getException

LDAPException getException()
Returns an embedded exception response

Returns:
an embedded exception if any

getActiveReferral

ReferralInfo getActiveReferral()
Indicates the referral instance being followed if the connection created to follow referrals.

Returns:
the referral being followed

setDeserializedValues

protected void setDeserializedValues(LDAPMessage readObject,
                                     RfcControls asn1Ctrls)
                              throws java.io.IOException,
                                     java.lang.ClassNotFoundException
Overrides:
setDeserializedValues in class LDAPMessage
Throws:
java.io.IOException
java.lang.ClassNotFoundException

All LDAP Classes
Internal LDAP Classes

Copyright ? 2002 Novell, Inc. All Rights Reserved.
Novell, Inc.
1800 South Novell Place
Provo, Ut 84606
Phone: (801) 861-5000