Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.service.contactsource
Class AbstractContactQuery<T extends ContactSourceService>

java.lang.Object
  extended by net.java.sip.communicator.service.contactsource.AbstractContactQuery<T>
Type Parameters:
T - the very type of ContactSourceService which performs the ContactQuery
All Implemented Interfaces:
ContactQuery
Direct Known Subclasses:
AsyncContactQuery

public abstract class AbstractContactQuery<T extends ContactSourceService>
extends Object
implements ContactQuery

Provides an abstract implementation of the basic functionality of ContactQuery and allows extenders to focus on the specifics of their implementation.

Author:
Lyubomir Marinov

Field Summary
 
Fields inherited from interface net.java.sip.communicator.service.contactsource.ContactQuery
QUERY_CANCELED, QUERY_COMPLETED, QUERY_ERROR, QUERY_IN_PROGRESS
 
Constructor Summary
protected AbstractContactQuery(T contactSource)
          Initializes a new AbstractContactQuery which is to be performed by a specific ContactSourceService.
 
Method Summary
 void addContactQueryListener(ContactQueryListener l)
          Adds a ContactQueryListener to the list of listeners interested in notifications about this ContactQuery changing its status, the receipt of new SourceContacts via this ContactQuery, etc.
 void cancel()
          Cancels this ContactQuery.
protected  void fireContactReceived(SourceContact contact)
          Notifies the ContactQueryListeners registered with this ContactQuery that a new SourceContact has been received.
protected  void fireQueryStatusChanged(int eventType)
          Notifies the ContactQueryListeners registered with this ContactQuery that its state has changed.
 T getContactSource()
          Gets the ContactSourceService which is performing this ContactQuery.
 int getStatus()
          Gets the status of this ContactQuery which can be one of the QUERY_XXX constants defined by ContactQuery.
 void removeContactQueryListener(ContactQueryListener l)
          Removes a ContactQueryListener from the list of listeners interested in notifications about this ContactQuery changing its status, the receipt of new SourceContacts via this ContactQuery, etc.
 void setStatus(int status)
          Sets the status of this ContactQuery.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.java.sip.communicator.service.contactsource.ContactQuery
getQueryResults, getQueryString
 

Constructor Detail

AbstractContactQuery

protected AbstractContactQuery(T contactSource)
Initializes a new AbstractContactQuery which is to be performed by a specific ContactSourceService. The status of the new instance is ContactQuery.QUERY_IN_PROGRESS.

Parameters:
contactSource - the ContactSourceService which is to perform the new AbstractContactQuery
Method Detail

addContactQueryListener

public void addContactQueryListener(ContactQueryListener l)
Adds a ContactQueryListener to the list of listeners interested in notifications about this ContactQuery changing its status, the receipt of new SourceContacts via this ContactQuery, etc.

Specified by:
addContactQueryListener in interface ContactQuery
Parameters:
l - the ContactQueryListener to be added to the list of listeners interested in the notifications raised by this ContactQuery
See Also:
ContactQuery.addContactQueryListener(ContactQueryListener)

cancel

public void cancel()
Cancels this ContactQuery.

Specified by:
cancel in interface ContactQuery
See Also:
ContactQuery.cancel()

fireContactReceived

protected void fireContactReceived(SourceContact contact)
Notifies the ContactQueryListeners registered with this ContactQuery that a new SourceContact has been received.

Parameters:
contact - the SourceContact which has been received and which the registered ContactQueryListeners are to be notified about

fireQueryStatusChanged

protected void fireQueryStatusChanged(int eventType)
Notifies the ContactQueryListeners registered with this ContactQuery that its state has changed.

Parameters:
eventType - the type of the ContactQueryStatusEvent to be fired which can be one of the QUERY_XXX constants defined by ContactQueryStatusEvent

getContactSource

public T getContactSource()
Gets the ContactSourceService which is performing this ContactQuery.

Specified by:
getContactSource in interface ContactQuery
Returns:
the ContactSourceService which is performing this ContactQuery
See Also:
ContactQuery.getContactSource()

getStatus

public int getStatus()
Gets the status of this ContactQuery which can be one of the QUERY_XXX constants defined by ContactQuery.

Specified by:
getStatus in interface ContactQuery
Returns:
the status of this ContactQuery which can be one of the QUERY_XXX constants defined by ContactQuery
See Also:
ContactQuery.getStatus()

removeContactQueryListener

public void removeContactQueryListener(ContactQueryListener l)
Removes a ContactQueryListener from the list of listeners interested in notifications about this ContactQuery changing its status, the receipt of new SourceContacts via this ContactQuery, etc.

Specified by:
removeContactQueryListener in interface ContactQuery
Parameters:
l - the ContactQueryListener to be removed from the list of listeners interested in notifications raised by this ContactQuery
See Also:
ContactQuery.removeContactQueryListener(ContactQueryListener)

setStatus

public void setStatus(int status)
Sets the status of this ContactQuery.

Parameters:
status - ContactQuery.QUERY_CANCELED, ContactQuery.QUERY_COMPLETED, or ContactQuery.QUERY_ERROR

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.