Interface RosterStore

  • All Known Implementing Classes:
    DirectoryRosterStore

    public interface RosterStore
    This is an interface for persistent roster store needed to implement roster versioning as per RFC 6121.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean addEntry​(RosterPacket.Item item, java.lang.String version)
      This method stores a new roster entry in this store or updates an existing one.
      java.util.List<RosterPacket.Item> getEntries()
      This method returns a list of all roster items contained in this store.
      RosterPacket.Item getEntry​(Jid bareJid)
      This method returns the roster item in this store for the given JID.
      java.lang.String getRosterVersion()
      This method returns the version number as specified by the "ver" attribute of the local store.
      boolean removeEntry​(Jid bareJid, java.lang.String version)
      Removes an entry from the store.
      boolean resetEntries​(java.util.Collection<RosterPacket.Item> items, java.lang.String version)
      This method updates the store so that it contains only the given entries.
      void resetStore()
      Reset the store by removing all entries and setting the version to the empty String.
    • Method Detail

      • getEntries

        java.util.List<RosterPacket.ItemgetEntries()
        This method returns a list of all roster items contained in this store. If there was an error while loading the store, then null is returned.
        Returns:
        List of RosterEntry or null.
      • getEntry

        RosterPacket.Item getEntry​(Jid bareJid)
        This method returns the roster item in this store for the given JID.
        Parameters:
        bareJid - The bare JID of the RosterEntry
        Returns:
        The RosterEntry which belongs to that user
      • getRosterVersion

        java.lang.String getRosterVersion()
        This method returns the version number as specified by the "ver" attribute of the local store. For a fresh store, this MUST be the empty string.
        Returns:
        local roster version
      • addEntry

        boolean addEntry​(RosterPacket.Item item,
                         java.lang.String version)
        This method stores a new roster entry in this store or updates an existing one.
        Parameters:
        item - the entry to store
        version - the new roster version
        Returns:
        True if successful
      • resetEntries

        boolean resetEntries​(java.util.Collection<RosterPacket.Item> items,
                             java.lang.String version)
        This method updates the store so that it contains only the given entries.
        Parameters:
        items - the entries to store
        version - the new roster version
        Returns:
        True if successful
      • removeEntry

        boolean removeEntry​(Jid bareJid,
                            java.lang.String version)
        Removes an entry from the store.
        Parameters:
        bareJid - The bare JID of the entry to be removed
        version - the new roster version
        Returns:
        True if successful
      • resetStore

        void resetStore()
        Reset the store by removing all entries and setting the version to the empty String.
        Since:
        4.2