Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.base.database
Class DbPresenceManager

java.lang.Object
  extended by com.jivesoftware.base.database.DbPresenceManager
All Implemented Interfaces:
UserListener, JiveManager, PresenceManager

public class DbPresenceManager
extends java.lang.Object
implements PresenceManager, JiveManager, UserListener

Database implementation of the PresenceManager interface.


Field Summary
 Cache onlineGuestCache
           
 Cache onlineUserCache
           
 Cache userRosterCache
           
 
Fields inherited from interface com.jivesoftware.base.PresenceManager
SORT_ONLINE_TIME, SORT_USERNAME
 
Method Summary
 Presence createPresence(User user, java.lang.String uid, java.lang.String IPAddress)
          Create a presence for a user.
 void destroy()
          Notifies the manager to release any resources that may be holding on too.
static DbPresenceManager getInstance()
           
 int getOnlineGuestCount()
          Returns the number of guests who are currently online.
 int getOnlineUserCount()
          Returns the number of users who are currently online.
 int getOnlineUserCount(Group group)
          Returns the number of users in the group who are currently online.
 java.util.Iterator getOnlineUsers()
          Returns an iterator of users who are currently online.
 java.util.Iterator getOnlineUsers(boolean ascending, int sortField)
          Returns an iterator of users sorted in the manner requested who are currently online.
 java.util.Iterator getOnlineUsers(boolean ascending, int sortField, int numResults)
          Returns an iterator of users who are currently online matching the criteria given.
 java.util.Iterator getOnlineUsers(boolean ascending, int sortField, int start, int numResults)
          Returns an iterator of users who are currently online matching the criteria given.
 java.util.Iterator getOnlineUsers(Group group)
          Returns an iterator of users in the group who are currently online.
 java.util.Iterator getOnlineUsers(Group group, boolean ascending, int sortField)
          Returns an iterator of users sorted in the manner requested who are currently online.
 java.util.Iterator getOnlineUsers(Group group, boolean ascending, int sortField, int numResults)
          Returns an iterator of users who are currently online matching the criteria given.
 Presence getPresence(java.lang.String presenceID)
           
 Presence getPresence(User user)
          Returns the presence for the user, or null if the user isn't online.
 Roster getRoster(User user)
          Returns the user's roster.
 void initialize()
          Initialize the manager.
 boolean isOnline(User user)
          Returns whether the user is currently online or not.
 boolean isPresencesEnabled()
          Returns whether presences are enabled on a global basis or not.
 void setOffline(Presence presence)
          Sets a presence to be offline which causes the presence to be removed from the system.
 void setOnline(Presence presence)
           
 void setPresencesEnabled(boolean enabled)
          Sets whether presences are enabled on a global basis or not.
 void userCreated(UserEvent event)
          Fired when a user is created.
 void userDeleted(UserEvent event)
          Fired when a user is deleted.
 void userModified(UserEvent event)
          Fired when a user is modified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

onlineGuestCache

public Cache onlineGuestCache

onlineUserCache

public Cache onlineUserCache

userRosterCache

public Cache userRosterCache
Method Detail

getInstance

public static DbPresenceManager getInstance()

initialize

public void initialize()
Description copied from interface: JiveManager
Initialize the manager. It is within this method that it is ok to create, access and/or otherwise use external classes (including caches). Until this method is called implementation should not access any external classes that could possibly either access one of the main Factory classes or any caches since doing so can cause deadlocks and possible clustering issues during startup.

This method is used internally by Jive during application startup and should not be called during normal usage of the class.

Specified by:
initialize in interface JiveManager

destroy

public void destroy()
Description copied from interface: JiveManager
Notifies the manager to release any resources that may be holding on too. This could also be used to clear out the managers caches, etc.

This method is used internally by Jive during application startup and should not be called during normal usage of the class.

Specified by:
destroy in interface JiveManager

isPresencesEnabled

public boolean isPresencesEnabled()
Description copied from interface: PresenceManager
Returns whether presences are enabled on a global basis or not.

Specified by:
isPresencesEnabled in interface PresenceManager
Returns:
whether presences are enabled on a global basis or not.

setPresencesEnabled

public void setPresencesEnabled(boolean enabled)
                         throws UnauthorizedException
Description copied from interface: PresenceManager
Sets whether presences are enabled on a global basis or not.

Specified by:
setPresencesEnabled in interface PresenceManager
Parameters:
enabled - true if presences should be enabled, false otherwise.
Throws:
UnauthorizedException - if not a system administrator.

getOnlineUserCount

public int getOnlineUserCount()
Description copied from interface: PresenceManager
Returns the number of users who are currently online. Online users with a presence status set to invisible will not be included.

Specified by:
getOnlineUserCount in interface PresenceManager
Returns:
the number of online users.

getOnlineUserCount

public int getOnlineUserCount(Group group)
Description copied from interface: PresenceManager
Returns the number of users in the group who are currently online. Online users with a presence status set to invisible will not be included.

Specified by:
getOnlineUserCount in interface PresenceManager
Parameters:
group - the group to return the online user count.
Returns:
the number of online users in the group.

getOnlineGuestCount

public int getOnlineGuestCount()
Description copied from interface: PresenceManager
Returns the number of guests who are currently online. Guests with a presence status other that online or idle will not be included.

Specified by:
getOnlineGuestCount in interface PresenceManager
Returns:
the number of online users.

getOnlineUsers

public java.util.Iterator getOnlineUsers()
Description copied from interface: PresenceManager
Returns an iterator of users who are currently online. Online users with a presence status other that online or idle will not be included.

Specified by:
getOnlineUsers in interface PresenceManager
Returns:
an iterator of online users.

getOnlineUsers

public java.util.Iterator getOnlineUsers(Group group)
Description copied from interface: PresenceManager
Returns an iterator of users in the group who are currently online. Online users with a presence statas set to invisible will not be included.

Specified by:
getOnlineUsers in interface PresenceManager
Parameters:
group - the group to return the online users.
Returns:
an iterator of online users in the group.

getOnlineUsers

public java.util.Iterator getOnlineUsers(boolean ascending,
                                         int sortField)
Description copied from interface: PresenceManager
Returns an iterator of users sorted in the manner requested who are currently online. Online users with a presence status other that online or idle will not be included.

Specified by:
getOnlineUsers in interface PresenceManager
Parameters:
ascending - sort ascending if true, descending if false.
sortField - a valid sort field from the PresenceManager interface.
Returns:
an iterator of online users.

getOnlineUsers

public java.util.Iterator getOnlineUsers(Group group,
                                         boolean ascending,
                                         int sortField)
Description copied from interface: PresenceManager
Returns an iterator of users sorted in the manner requested who are currently online. Online users with a presence status other that online or idle will not be included.

Specified by:
getOnlineUsers in interface PresenceManager
Parameters:
group - the group to return the online users.
ascending - sort ascending if true, descending if false.
sortField - a valid sort field from the PresenceManager interface.
Returns:
an iterator of online users in the group.

getOnlineUsers

public java.util.Iterator getOnlineUsers(boolean ascending,
                                         int sortField,
                                         int numResults)
Description copied from interface: PresenceManager
Returns an iterator of users who are currently online matching the criteria given. Online users with a presence status other than online or idle will not be included.

Specified by:
getOnlineUsers in interface PresenceManager
Parameters:
ascending - sort ascending if true, descending if false.
sortField - a valid sort field from the PresenceManager interface.
numResults - - the number of results to return.
Returns:
an iterator of online users matching the given criteria.

getOnlineUsers

public java.util.Iterator getOnlineUsers(boolean ascending,
                                         int sortField,
                                         int start,
                                         int numResults)
Description copied from interface: PresenceManager
Returns an iterator of users who are currently online matching the criteria given. Online users with a presence status other than online or idle will not be included.

Specified by:
getOnlineUsers in interface PresenceManager
Parameters:
ascending - sort ascending if true, descending if false.
sortField - a valid sort field from the PresenceManager interface.
start - the index into the sorted set of users to start iterating from.
numResults - - the number of results to return.
Returns:
an iterator of online users matching the given criteria.

getOnlineUsers

public java.util.Iterator getOnlineUsers(Group group,
                                         boolean ascending,
                                         int sortField,
                                         int numResults)
Description copied from interface: PresenceManager
Returns an iterator of users who are currently online matching the criteria given. Online users with a presence status other than online or idle will not be included.

Specified by:
getOnlineUsers in interface PresenceManager
ascending - sort ascending if true, descending if false.
sortField - a valid sort field from the PresenceManager interface.
numResults - - the number of results to return.
Returns:
an iterator of online users matching the given criteria.

createPresence

public Presence createPresence(User user,
                               java.lang.String uid,
                               java.lang.String IPAddress)
Description copied from interface: PresenceManager
Create a presence for a user. Creating a presence will automatically set the user to be online.

The uid should be unique within the application instance. A good source of a uid is the servlet session id.

Specified by:
createPresence in interface PresenceManager
Parameters:
user - the user to create a presence for.
uid - a unique string.
IPAddress - the IP address of the user.
Returns:
the presence for the user.

setOnline

public void setOnline(Presence presence)

setOffline

public void setOffline(Presence presence)
Description copied from interface: PresenceManager
Sets a presence to be offline which causes the presence to be removed from the system.

Specified by:
setOffline in interface PresenceManager
Parameters:
presence - to presence to set to be offline.

isOnline

public boolean isOnline(User user)
Description copied from interface: PresenceManager
Returns whether the user is currently online or not. If the user's status is set to Presence.STATUS_INVISIBLE, the user will never show up as online.

Specified by:
isOnline in interface PresenceManager
Parameters:
user - the user to check to see if they're online.

getPresence

public Presence getPresence(User user)
Description copied from interface: PresenceManager
Returns the presence for the user, or null if the user isn't online.

Specified by:
getPresence in interface PresenceManager
Parameters:
user - the user to return the presence for.
Returns:
the presence for the user, or null if the user isn't online.

getPresence

public Presence getPresence(java.lang.String presenceID)

getRoster

public Roster getRoster(User user)
Description copied from interface: PresenceManager
Returns the user's roster. A roster is a list of users that the user wishes to know if they are online. Rosters are similar to buddy groups in popular IM clients.

Specified by:
getRoster in interface PresenceManager
Parameters:
user - the user to return the roster for.
Returns:
the user's roster.

userCreated

public void userCreated(UserEvent event)
Description copied from interface: UserListener
Fired when a user is created.

Specified by:
userCreated in interface UserListener
Parameters:
event - the UserEvent

userDeleted

public void userDeleted(UserEvent event)
Description copied from interface: UserListener
Fired when a user is deleted.

Specified by:
userDeleted in interface UserListener
Parameters:
event - the UserEvent

userModified

public void userModified(UserEvent event)
Description copied from interface: UserListener
Fired when a user is modified.

Specified by:
userModified in interface UserListener
Parameters:
event - the UserEvent

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.