public class FSBuddyStorage extends java.lang.Object implements BuddyStorage
Stores each buddy list under the {SFS2X-folder}/data/buddylists/{Zonename}/{Username} folder
Where {Username} is the "encoded" version of the User name. The encoded name consist simply of the hexadecimal version
of the name. This allows to store any user name in the file system including those containing avoid characters (such as *, :, ? etc...)
| Constructor and Description |
|---|
FSBuddyStorage() |
| 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) |
public void init()
BuddyStorageAdd 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...
init in interface BuddyStoragepublic void destroy()
BuddyStorageThis 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.
destroy in interface BuddyStoragepublic BuddyList loadList(java.lang.String ownerName) throws SFSBuddyListNotFoundException, java.io.IOException
BuddyStorageloadList in interface BuddyStorageownerName - 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 processpublic void saveList(BuddyList buddyList) throws java.io.IOException
BuddyStoragesaveList in interface BuddyStoragebuddyList - the BuddyListjava.io.IOException - thrown if any error arises during the saving processpublic java.util.List<BuddyVariable> getOfflineVariables(java.lang.String buddyName) throws java.io.IOException
BuddyStorageSince 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.
getOfflineVariables in interface BuddyStoragebuddyName - the name of the Buddyjava.io.IOException - thrown if the loading process failspublic BuddyListManager getBuddyListManager()
BuddyStoragegetBuddyListManager in interface BuddyStoragepublic void setBuddyListManager(BuddyListManager buddyListManager)
setBuddyListManager in interface BuddyStorage