Interface BuddyStorage

  • All Known Implementing Classes:
    FSBuddyStorage

    public interface BuddyStorage
    • Method Detail

      • init

        void init()
        Initialize the Storage class

        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...

      • destroy

        void destroy()
        Destroy the Storage class.

        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.

      • loadList

        BuddyList loadList​(java.lang.String ownerName)
                    throws SFSBuddyListNotFoundException,
                           java.io.IOException
        Load a Buddy List from your data source. This method is invoked by the Buddy System when Buddy data needs to be loaded.
        Parameters:
        ownerName - name of the BuddyList owner
        Returns:
        the BuddyList
        Throws:
        SFSBuddyListNotFoundException - thrown if no BuddyList is found for the required User
        java.io.IOException - thrown if any problem arises during the loading process
      • saveList

        void saveList​(BuddyList buddyList)
               throws java.io.IOException
        This method is invoked by the Buddy System when a BuddyList needs to be saved.
        Parameters:
        buddyList - the BuddyList
        Throws:
        java.io.IOException - thrown if any error arises during the saving process
      • getOfflineVariables

        java.util.List<BuddyVariable> getOfflineVariables​(java.lang.String buddyName)
                                                   throws java.io.IOException
        Load the off-line persistent variables for a specific User.

        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.

        Parameters:
        buddyName - the name of the Buddy
        Returns:
        the List of off-line BuddyVariables
        Throws:
        java.io.IOException - thrown if the loading process fails
      • getBuddyListManager

        BuddyListManager getBuddyListManager()
        Get a reference to the BuddyManager managing this BuddyStorage class
        Returns:
        the BuddyManager
      • setBuddyListManager

        void setBuddyListManager​(BuddyListManager buddyListManager)