|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectit.gotoandplay.smartfoxserver.data.buddylist.persistence.AbstractBuddyPersister
it.gotoandplay.smartfoxserver.extensions.examples.BuddyListDatabasePersister
public class BuddyListDatabasePersister
This class shows how you can implement your own custom persistency system for the SmartFoxServer buddy lists.
You start by extending the AbstractBuddyPersister class and overriding the loadBuddyList() and saveBuddyList() methods. These methods take care of loading and saving the buddy list for the specified user.
There is an additional method that can be overridden called saveAllBuddyLists(). Its default implementation just
cycles through all users in the Zone whose buddylist was modified, and passes them to the saveBuddyList method.
If you need a more advanced implementation you can override it.
This method is usually invoked by the server when restarting or shutting down.
Finally there's two usefull methods called init() and destroy() that can be used to start up and shut down the persister object.
| Constructor Summary | |
|---|---|
BuddyListDatabasePersister()
|
|
| Method Summary | |
|---|---|
void |
init(java.lang.Object param)
Here we initialize the persister class |
StorableBuddyList |
loadList(java.lang.String userName)
Load the buddy list for the specified user |
boolean |
saveList(java.lang.String userName,
StorableBuddyList buddyList)
Save the buddy list of for the specified user |
| Methods inherited from class it.gotoandplay.smartfoxserver.data.buddylist.persistence.AbstractBuddyPersister |
|---|
destroy, getOfflineVariables, removeOfflineBuddy, saveAll, setZoneName |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BuddyListDatabasePersister()
| Method Detail |
|---|
public void init(java.lang.Object param)
init in interface it.gotoandplay.smartfoxserver.lib.IServiceinit in class AbstractBuddyPersisterpublic StorableBuddyList loadList(java.lang.String userName)
IBuddyListPersister
loadList in interface IBuddyListPersisterloadList in class AbstractBuddyPersisteruserName - the user name
public boolean saveList(java.lang.String userName,
StorableBuddyList buddyList)
IBuddyListPersister
saveList in interface IBuddyListPersistersaveList in class AbstractBuddyPersisteruserName - the user namebuddyList - the list of buddies
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||