LDAP Classes
Implements Java LDAP

com.novell.ldap
Class LDAPMessage

java.lang.Object
  extended bycom.novell.ldap.LDAPMessage
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable
Direct Known Subclasses:
LDAPAbandonRequest, LDAPAddRequest, LDAPBindRequest, LDAPCompareRequest, LDAPDeleteRequest, LDAPExtendedRequest, LDAPModifyDNRequest, LDAPModifyRequest, LDAPResponse, LDAPSearchRequest, LDAPSearchResult, LDAPSearchResultReference, LDAPUnbindRequest

public class LDAPMessage
extends java.lang.Object
implements java.io.Externalizable

The base class for LDAP request and response messages.

Subclassed by response messages used in asynchronous operations.

Sample Code: Searchas.java

See Also:
Serialized Form

Field Summary
static int ABANDON_REQUEST
          An abandon request operation.
static int ADD_REQUEST
          An add request operation.
static int ADD_RESPONSE
          An add response operation.
static int BIND_REQUEST
          A bind request operation.
static int BIND_RESPONSE
          A bind response operation.
static int COMPARE_REQUEST
          A compare result operation.
static int COMPARE_RESPONSE
          A compare response operation.
static int DEL_REQUEST
          A delete request operation.
static int DEL_RESPONSE
          A delete response operation.
static int EXTENDED_REQUEST
          An extended request operation.
static int EXTENDED_RESPONSE
          An extended response operation.
static int INTERMEDIATE_RESPONSE
          An extended response operation.
protected  com.novell.ldap.rfc2251.RfcLDAPMessage message
          A request or response message for an asynchronous LDAP operation.
static int MODIFY_RDN_REQUEST
          A modify RDN request operation.
static int MODIFY_RDN_RESPONSE
          A modify RDN response operation.
static int MODIFY_REQUEST
          A modify request operation.
static int MODIFY_RESPONSE
          A modify response operation.
static int SEARCH_REQUEST
          A search request operation.
static int SEARCH_RESPONSE
          A search response containing data.
static int SEARCH_RESULT
          A search result message - contains search status.
static int SEARCH_RESULT_REFERENCE
          A search result reference operation.
static int UNBIND_REQUEST
          An unbind request operation.
 
Constructor Summary
protected LDAPMessage(com.novell.ldap.rfc2251.RfcLDAPMessage message)
          Creates an Rfc 2251 LDAPMessage when the libraries receive a response from a command.
 
Method Summary
 LDAPControl[] getControls()
          Returns any controls in the message.
 int getMessageID()
          Returns the message ID.
 java.lang.String getTag()
          Retrieves the identifier tag for this message.
 int getType()
          Returns the LDAP operation type of the message.
 boolean isRequest()
          Indicates whether the message is a request or a response
static java.lang.Object readDSML(java.io.InputStream input)
          This method is used to deserialize the DSML encoded representation of this class.
 void readExternal(java.io.ObjectInput in)
          Reads the serialized object from the underlying input stream.
protected  void setDeserializedValues(LDAPMessage readObject, com.novell.ldap.rfc2251.RfcControls asn1Ctrls)
           
 void setTag(java.lang.String stringTag)
          Sets a string identifier tag for this message.
 java.lang.String toString()
          Creates a String representation of this object
 void writeDSML(java.io.OutputStream oout)
          This method does DSML serialization of the instance.
 void writeExternal(java.io.ObjectOutput out)
          Writes the object state to a stream in XML format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BIND_REQUEST

public static final int BIND_REQUEST
A bind request operation.

BIND_REQUEST = 0

See Also:
Constant Field Values

BIND_RESPONSE

public static final int BIND_RESPONSE
A bind response operation.

BIND_RESPONSE = 1

See Also:
Constant Field Values

UNBIND_REQUEST

public static final int UNBIND_REQUEST
An unbind request operation.

UNBIND_REQUEST = 2

See Also:
Constant Field Values

SEARCH_REQUEST

public static final int SEARCH_REQUEST
A search request operation.

SEARCH_REQUEST = 3

See Also:
Constant Field Values

SEARCH_RESPONSE

public static final int SEARCH_RESPONSE
A search response containing data.

SEARCH_RESPONSE = 4

See Also:
Constant Field Values

SEARCH_RESULT

public static final int SEARCH_RESULT
A search result message - contains search status.

SEARCH_RESULT = 5

See Also:
Constant Field Values

MODIFY_REQUEST

public static final int MODIFY_REQUEST
A modify request operation.

MODIFY_REQUEST = 6

See Also:
Constant Field Values

MODIFY_RESPONSE

public static final int MODIFY_RESPONSE
A modify response operation.

MODIFY_RESPONSE = 7

See Also:
Constant Field Values

ADD_REQUEST

public static final int ADD_REQUEST
An add request operation.

ADD_REQUEST = 8

See Also:
Constant Field Values

ADD_RESPONSE

public static final int ADD_RESPONSE
An add response operation.

ADD_RESONSE = 9

See Also:
Constant Field Values

DEL_REQUEST

public static final int DEL_REQUEST
A delete request operation.

DEL_REQUEST = 10

See Also:
Constant Field Values

DEL_RESPONSE

public static final int DEL_RESPONSE
A delete response operation.

DEL_RESONSE = 11

See Also:
Constant Field Values

MODIFY_RDN_REQUEST

public static final int MODIFY_RDN_REQUEST
A modify RDN request operation.

MODIFY_RDN_REQUEST = 12

See Also:
Constant Field Values

MODIFY_RDN_RESPONSE

public static final int MODIFY_RDN_RESPONSE
A modify RDN response operation.

MODIFY_RDN_RESPONSE = 13

See Also:
Constant Field Values

COMPARE_REQUEST

public static final int COMPARE_REQUEST
A compare result operation.

COMPARE_REQUEST = 14

See Also:
Constant Field Values

COMPARE_RESPONSE

public static final int COMPARE_RESPONSE
A compare response operation.

COMPARE_RESPONSE = 15

See Also:
Constant Field Values

ABANDON_REQUEST

public static final int ABANDON_REQUEST
An abandon request operation.

ABANDON_REQUEST = 16

See Also:
Constant Field Values

SEARCH_RESULT_REFERENCE

public static final int SEARCH_RESULT_REFERENCE
A search result reference operation.

SEARCH_RESULT_REFERENCE = 19

See Also:
Constant Field Values

EXTENDED_REQUEST

public static final int EXTENDED_REQUEST
An extended request operation.

EXTENDED_REQUEST = 23

See Also:
Constant Field Values

EXTENDED_RESPONSE

public static final int EXTENDED_RESPONSE
An extended response operation.

EXTENDED_RESONSE = 24

See Also:
Constant Field Values

INTERMEDIATE_RESPONSE

public static final int INTERMEDIATE_RESPONSE
An extended response operation.

EXTENDED_RESONSE = 24

See Also:
Constant Field Values

message

protected com.novell.ldap.rfc2251.RfcLDAPMessage message
A request or response message for an asynchronous LDAP operation.

Constructor Detail

LDAPMessage

protected LDAPMessage(com.novell.ldap.rfc2251.RfcLDAPMessage message)
Creates an Rfc 2251 LDAPMessage when the libraries receive a response from a command.

Parameters:
message - A response message.
Method Detail

getControls

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


getMessageID

public int getMessageID()
Returns the message ID. The message ID is an integer value identifying the LDAP request and its response.


getType

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

The type is one of the following:

Returns:
The operation type of the message.

isRequest

public boolean isRequest()
Indicates whether the message is a request or a response

Returns:
true if the message is a request, false if it is a response, a search result, or a search result reference.

toString

public java.lang.String toString()
Creates a String representation of this object

Returns:
a String representation for this LDAPMessage

setTag

public void setTag(java.lang.String stringTag)
Sets a string identifier tag for this message.

This method allows an API to set a tag and later identify messages by retrieving the tag associated with the message. Tags are set by the application and not by the API or the server. Message tags are not included with any message sent to or received from the server.

Tags set on a request to the server are automatically associated with the response messages when they are received by the API and transferred to the application. The application can explicitly set a different value in a response message.

To set a value in a server request, for example an LDAPSearchRequest, you must create the object, set the tag, and use the LDAPConnection.sendRequest() method to send it to the server.

Parameters:
stringTag - the String assigned to identify this message.
See Also:
getTag(), isRequest()

getTag

public java.lang.String getTag()
Retrieves the identifier tag for this message.

An identifier can be associated with a message with the setTag method. Tags are set by the application and not by the API or the server. If a server response isRequest() == false has no tag, the tag associated with the corresponding server request is used.

Returns:
the identifier associated with this message or null if none.
See Also:
setTag(java.lang.String), isRequest()

writeDSML

public void writeDSML(java.io.OutputStream oout)
               throws java.io.IOException
This method does DSML serialization of the instance.

Parameters:
oout - Outputstream where the serialzed data has to be written
Throws:
java.io.IOException - if write fails on OutputStream

readDSML

public static java.lang.Object readDSML(java.io.InputStream input)
                                 throws java.io.IOException
This method is used to deserialize the DSML encoded representation of this class.

Parameters:
input - InputStream for the DSML formatted data.
Returns:
Deserialized form of this class.
Throws:
java.io.IOException - when serialization fails.

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Writes the object state to a stream in XML format

Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
out - The ObjectOutput stream where the Object in XML format is being written to
Throws:
java.io.IOException - - If I/O errors occur

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Reads the serialized object from the underlying input stream.

Specified by:
readExternal in interface java.io.Externalizable
Parameters:
in - The ObjectInput stream where the Serialized Object is being read from
Throws:
java.io.IOException - - If I/O errors occur
java.lang.ClassNotFoundException - - If the class for an object being restored cannot be found.

setDeserializedValues

protected void setDeserializedValues(LDAPMessage readObject,
                                     com.novell.ldap.rfc2251.RfcControls asn1Ctrls)
                              throws java.io.IOException,
                                     java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

LDAP Classes
Implements Java LDAP

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