netscape.ldap
Class LDAPMessage

java.lang.Object
  extended by netscape.ldap.LDAPMessage
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
LDAPResponse, LDAPSearchResult, LDAPSearchResultReference

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

Base class for LDAP request and response messages. This class represents the LDAPMessage in RFC2251. The message is the entity that got transferred back and fro between the server and the client interface. Each message has a protocol operation. The protocol operation indicates if it is a request or response.

 LDAPMessage ::= SEQUENCE {
   messageID MessageID,
   protocolOp CHOICE {
     bindRequest BindRequest,
     ...
   }
   controls [0] Controls OPTIONAL
 }
 

Version:
1.0
See Also:
Serialized Form

Field Summary
static int ABANDON_REQUEST
           
static int ADD_REQUEST
           
static int ADD_RESPONSE
           
static int BIND_REQUEST
           
static int BIND_RESPONSE
           
static int COMPARE_REQUEST
           
static int COMPARE_RESPONSE
           
static int DEL_REQUEST
           
static int DEL_RESPONSE
           
static int EXTENDED_REQUEST
           
static int EXTENDED_RESPONSE
           
static int MODIFY_RDN_REQUEST
           
static int MODIFY_RDN_RESPONSE
           
static int MODIFY_REQUEST
           
static int MODIFY_RESPONSE
           
static int SEARCH_REQUEST
           
static int SEARCH_RESPONSE
           
static int SEARCH_RESULT
           
static int SEARCH_RESULT_REFERENCE
           
(package private) static long serialVersionUID
           
static int UNBIND_REQUEST
           
 
Constructor Summary
LDAPMessage(int msgid, JDAPProtocolOp op)
          Constructs a ldap message.
LDAPMessage(int msgid, JDAPProtocolOp op, LDAPControl[] controls)
           
 
Method Summary
 LDAPControl[] getControls()
          Retrieves list of controls.
 int getMessageID()
          Returns the message identifer.
(package private)  JDAPProtocolOp getProtocolOp()
          Retrieves the protocol operation.
 int getType()
          Returns the LDAP operation type of the message
(package private) static LDAPMessage parseMessage(BERElement element)
          Creates a ldap message from a BERElement.
 java.lang.String toString()
          Returns string representation of an LDAP message.
(package private)  java.lang.StringBuffer toTraceString()
          Returns string representation of a ldap message with the time stamp.
(package private)  void write(java.io.OutputStream s)
          Writes the ber encoding to stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

BIND_REQUEST

public static final int BIND_REQUEST
See Also:
Constant Field Values

BIND_RESPONSE

public static final int BIND_RESPONSE
See Also:
Constant Field Values

UNBIND_REQUEST

public static final int UNBIND_REQUEST
See Also:
Constant Field Values

SEARCH_REQUEST

public static final int SEARCH_REQUEST
See Also:
Constant Field Values

SEARCH_RESPONSE

public static final int SEARCH_RESPONSE
See Also:
Constant Field Values

SEARCH_RESULT

public static final int SEARCH_RESULT
See Also:
Constant Field Values

MODIFY_REQUEST

public static final int MODIFY_REQUEST
See Also:
Constant Field Values

MODIFY_RESPONSE

public static final int MODIFY_RESPONSE
See Also:
Constant Field Values

ADD_REQUEST

public static final int ADD_REQUEST
See Also:
Constant Field Values

ADD_RESPONSE

public static final int ADD_RESPONSE
See Also:
Constant Field Values

DEL_REQUEST

public static final int DEL_REQUEST
See Also:
Constant Field Values

DEL_RESPONSE

public static final int DEL_RESPONSE
See Also:
Constant Field Values

MODIFY_RDN_REQUEST

public static final int MODIFY_RDN_REQUEST
See Also:
Constant Field Values

MODIFY_RDN_RESPONSE

public static final int MODIFY_RDN_RESPONSE
See Also:
Constant Field Values

COMPARE_REQUEST

public static final int COMPARE_REQUEST
See Also:
Constant Field Values

COMPARE_RESPONSE

public static final int COMPARE_RESPONSE
See Also:
Constant Field Values

ABANDON_REQUEST

public static final int ABANDON_REQUEST
See Also:
Constant Field Values

SEARCH_RESULT_REFERENCE

public static final int SEARCH_RESULT_REFERENCE
See Also:
Constant Field Values

EXTENDED_REQUEST

public static final int EXTENDED_REQUEST
See Also:
Constant Field Values

EXTENDED_RESPONSE

public static final int EXTENDED_RESPONSE
See Also:
Constant Field Values
Constructor Detail

LDAPMessage

LDAPMessage(int msgid,
            JDAPProtocolOp op)
Constructs a ldap message.

Parameters:
msgid - message identifier
op - operation protocol

LDAPMessage

LDAPMessage(int msgid,
            JDAPProtocolOp op,
            LDAPControl[] controls)
Method Detail

parseMessage

static LDAPMessage parseMessage(BERElement element)
                         throws java.io.IOException
Creates a ldap message from a BERElement. This method is used to parse LDAP response messages

Parameters:
element - ber element constructed from incoming byte stream
Throws:
java.io.IOException

getMessageID

public int getMessageID()
Returns the message identifer.

Returns:
message identifer.

getType

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

Returns:
message type.

getProtocolOp

JDAPProtocolOp getProtocolOp()
Retrieves the protocol operation.

Returns:
protocol operation.

getControls

public LDAPControl[] getControls()
Retrieves list of controls.

Returns:
controls.

write

void write(java.io.OutputStream s)
     throws java.io.IOException
Writes the ber encoding to stream.

Parameters:
s - output stream
Throws:
java.io.IOException

toString

public java.lang.String toString()
Returns string representation of an LDAP message.

Overrides:
toString in class java.lang.Object
Returns:
LDAP message.

toTraceString

java.lang.StringBuffer toTraceString()
Returns string representation of a ldap message with the time stamp. Used for message trace

Returns:
ldap message with the time stamp