it.gotoandplay.smartfoxserver.data.buddylist.persistence
Interface IBuddyListPersister

All Superinterfaces:
it.gotoandplay.smartfoxserver.lib.IService
All Known Implementing Classes:
AbstractBuddyPersister, BasicBuddyPersister, BuddyListDatabasePersister

public interface IBuddyListPersister
extends it.gotoandplay.smartfoxserver.lib.IService

IBuddyList persister provides a simple interface to handle custom loading and save of user's buddy lists.


Method Summary
 java.util.Map<java.lang.String,java.lang.String> getOfflineVariables(java.lang.String userName)
          Return a map of off-line variables.
 StorableBuddyList loadList(java.lang.String userName)
          Load the buddy list for the specified user
 boolean removeOfflineBuddy(java.lang.String owner, java.lang.String buddyName)
          Removes a buddy from a user list when the user is off-line
 void saveAll(java.util.Map<java.lang.String,StorableBuddyList> buddyLists)
          Save all buddy lists currently kept in memory.
 boolean saveList(java.lang.String userName, StorableBuddyList buddyList)
          Save the buddy list of for the specified user
 
Methods inherited from interface it.gotoandplay.smartfoxserver.lib.IService
destroy, init
 

Method Detail

loadList

StorableBuddyList loadList(java.lang.String userName)
Load the buddy list for the specified user

Parameters:
userName - the user name
Returns:
a list of buddies or null if buddy list does not exist

saveList

boolean saveList(java.lang.String userName,
                 StorableBuddyList buddyList)
Save the buddy list of for the specified user

Parameters:
userName - the user name
buddyList - the list of buddies

saveAll

void saveAll(java.util.Map<java.lang.String,StorableBuddyList> buddyLists)
Save all buddy lists currently kept in memory.
This is usually invoked when the server is shutting down or restarting

Parameters:
buddyLists - a map of buddy lists where the key is the user name and the value is the buddy list.

getOfflineVariables

java.util.Map<java.lang.String,java.lang.String> getOfflineVariables(java.lang.String userName)
Return a map of off-line variables. Off-line variables always start with a "$" symbol. Valid off-line buddy variables name are: $test, $_name, $3items ...

Parameters:
userName - owner of the variables
Returns:
the map of variables

removeOfflineBuddy

boolean removeOfflineBuddy(java.lang.String owner,
                           java.lang.String buddyName)
Removes a buddy from a user list when the user is off-line

Parameters:
owner - the buddy list owner
buddyName - the buddy name
Returns:
true, if the operation was successful