public interface BuddyStorage
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroy the Storage class.
|
BuddyListManager |
getBuddyListManager()
Get a reference to the BuddyManager managing this BuddyStorage class
|
java.util.List<BuddyVariable> |
getOfflineVariables(java.lang.String buddyName)
Load the off-line persistent variables for a specific User.
|
void |
init()
Initialize the Storage class
Add here all the necessary code to startup your BuddyStorage class.
|
BuddyList |
loadList(java.lang.String ownerName)
Load a Buddy List from your data source.
|
void |
saveList(BuddyList buddyList)
This method is invoked by the Buddy System when a BuddyList needs to be saved.
|
void |
setBuddyListManager(BuddyListManager buddyListManager) |
void init()
Add here all the necessary code to startup your BuddyStorage class. If you are using a database, this is the right place to start up your connection etc...
void destroy()
This method is invoked by the server when shutting down the Zones. Here you should make sure to release any resources you might have acquired in the init() phase.
BuddyList loadList(java.lang.String ownerName) throws SFSBuddyListNotFoundException, java.io.IOException
ownerName
- name of the BuddyList ownerSFSBuddyListNotFoundException
- thrown if no BuddyList is found for the required Userjava.io.IOException
- thrown if any problem arises during the loading processvoid saveList(BuddyList buddyList) throws java.io.IOException
buddyList
- the BuddyListjava.io.IOException
- thrown if any error arises during the saving processjava.util.List<BuddyVariable> getOfflineVariables(java.lang.String buddyName) throws java.io.IOException
Since off-line variables are available even when the Buddy is not online this method can be called at any time by the Buddy System. Using a cache to store these variables is usually recommended in order to avoid loading this data multiple timese from a "slow" data sources, such as the Database.
buddyName
- the name of the Buddyjava.io.IOException
- thrown if the loading process failsBuddyListManager getBuddyListManager()
void setBuddyListManager(BuddyListManager buddyListManager)