All LDAP Classes
Internal LDAP Classes

com.novell.ldap
Class LDAPMessageQueue

java.lang.Object
  extended by com.novell.ldap.LDAPMessageQueue
Direct Known Subclasses:
LDAPResponseQueue, LDAPSearchQueue

public abstract class LDAPMessageQueue
extends java.lang.Object

Represents a queue of incoming asynchronous messages from the server. It is the common interface for LDAPResponseQueue and LDAPSearchQueue.


Field Summary
(package private)  MessageAgent agent
          The message agent object associated with this queue
(package private)  java.lang.String name
           
(package private) static java.lang.Object nameLock
           
(package private) static int queueNum
           
 
Constructor Summary
LDAPMessageQueue(java.lang.String myname, MessageAgent agent)
          Constructs a response queue using the specified message agent
 
Method Summary
(package private)  java.lang.String getDebugName()
          Returns the name used for debug
(package private)  MessageAgent getMessageAgent()
          Returns the internal client message agent
 int[] getMessageIDs()
          Returns the message IDs for all outstanding requests.
 LDAPMessage getResponse()
          Returns the response from an LDAP request.
 LDAPMessage getResponse(int msgid)
          Returns the response from an LDAP request for a particular message ID.
private  LDAPMessage getResponse(java.lang.Integer msgid)
          Private implementation of getResponse.
 boolean isComplete(int msgid)
          Reports true if all results have been received for a particular message id.
 boolean isResponseReceived()
          Reports true if any response has been received from the server and not yet retrieved with getResponse.
 boolean isResponseReceived(int msgid)
          Reports true if a response has been received from the server for a particular message ID but not yet retrieved with getResponse.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

agent

MessageAgent agent
The message agent object associated with this queue


name

java.lang.String name

nameLock

static java.lang.Object nameLock

queueNum

static int queueNum
Constructor Detail

LDAPMessageQueue

LDAPMessageQueue(java.lang.String myname,
                 MessageAgent agent)
Constructs a response queue using the specified message agent

Parameters:
agent - The message agent to associate with this conneciton
Method Detail

getDebugName

java.lang.String getDebugName()
Returns the name used for debug

Returns:
name of object instance used for debug

getMessageAgent

MessageAgent getMessageAgent()
Returns the internal client message agent

Returns:
The internal client message agent

getMessageIDs

public int[] getMessageIDs()
Returns the message IDs for all outstanding requests. These are requests for which a response has not been received from the server or which still have messages to be retrieved with getResponse.

The last ID in the array is the messageID of the last submitted request.

Returns:
The message IDs for all outstanding requests.

getResponse

public LDAPMessage getResponse()
                        throws LDAPException
Returns the response from an LDAP request.

The getResponse method blocks until a response is available, or until all operations associated with the object have completed or been canceled, and then returns the response.

The application is responsible to determine the type of message returned.

Returns:
The response.
Throws:
LDAPException - A general exception which includes an error message and an LDAP error code.
See Also:
LDAPResponse, LDAPSearchResult, LDAPSearchResultReference

getResponse

public LDAPMessage getResponse(int msgid)
                        throws LDAPException
Returns the response from an LDAP request for a particular message ID.

The getResponse method blocks until a response is available for a particular message ID, or until all operations associated with the object have completed or been canceled, and then returns the response. If there is no outstanding operation for the message ID (or if it is zero or a negative number), IllegalArgumentException is thrown.

The application is responsible to determine the type of message returned.

Parameters:
msgid - query for responses for a specific message request
Returns:
The response from the server.
Throws:
LDAPException - A general exception which includes an error message and an LDAP error code.
See Also:
LDAPResponse, LDAPSearchResult, LDAPSearchResultReference

getResponse

private LDAPMessage getResponse(java.lang.Integer msgid)
                         throws LDAPException
Private implementation of getResponse. Has an Integer object as a parameter so we can distinguish the null and the message number case

Throws:
LDAPException

isResponseReceived

public boolean isResponseReceived()
Reports true if any response has been received from the server and not yet retrieved with getResponse. If getResponse has been used to retrieve all messages received to this point, then isResponseReceived returns false.

Returns:
true if a response is available to be retrieved via getResponse, otherwise false.
See Also:
getResponse()

isResponseReceived

public boolean isResponseReceived(int msgid)
Reports true if a response has been received from the server for a particular message ID but not yet retrieved with getResponse. If there is no outstanding operation for the message ID (or if it is zero or a negative number), IllegalArgumentException is thrown.

Parameters:
msgid - A particular message ID to query for available responses.
Returns:
true if a response is available to be retrieved via getResponse for the specified message ID, otherwise false.
See Also:
getResponse(int)

isComplete

public boolean isComplete(int msgid)
Reports true if all results have been received for a particular message id.

If the search result done has been received from the server for the message id, it reports true. There may still be messages waiting to be retrieved by the applcation with getResponse.

Throws:
java.lang.IllegalArgumentException - if there is no outstanding operation for the message ID,

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