Class DirectoryRosterStore

  • All Implemented Interfaces:
    RosterStore

    public final class DirectoryRosterStore
    extends java.lang.Object
    implements RosterStore
    Stores roster entries as specified by RFC 6121 for roster versioning in a set of files.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete 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.
      static DirectoryRosterStore init​(java.io.File baseDir)
      Creates a new roster store on disk.
      static DirectoryRosterStore open​(java.io.File baseDir)
      Opens a roster 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • init

        public static DirectoryRosterStore init​(java.io.File baseDir)
        Creates a new roster store on disk.
        Parameters:
        baseDir - TODO javadoc me please The directory to create the store in. The directory should be empty
        Returns:
        A DirectoryRosterStore instance if successful, null else.
      • open

        public static DirectoryRosterStore open​(java.io.File baseDir)
        Opens a roster store.
        Parameters:
        baseDir - TODO javadoc me please The directory containing the roster store.
        Returns:
        A DirectoryRosterStore instance if successful, null else.
      • getRosterVersion

        public java.lang.String getRosterVersion()
        Description copied from interface: RosterStore
        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.
        Specified by:
        getRosterVersion in interface RosterStore
        Returns:
        local roster version
      • addEntry

        public boolean addEntry​(RosterPacket.Item item,
                                java.lang.String version)
        Description copied from interface: RosterStore
        This method stores a new roster entry in this store or updates an existing one.
        Specified by:
        addEntry in interface RosterStore
        Parameters:
        item - the entry to store
        version - the new roster version
        Returns:
        True if successful
      • removeEntry

        public boolean removeEntry​(Jid bareJid,
                                   java.lang.String version)
        Description copied from interface: RosterStore
        Removes an entry from the store.
        Specified by:
        removeEntry in interface RosterStore
        Parameters:
        bareJid - The bare JID of the entry to be removed
        version - the new roster version
        Returns:
        True if successful
      • resetEntries

        public boolean resetEntries​(java.util.Collection<RosterPacket.Item> items,
                                    java.lang.String version)
        Description copied from interface: RosterStore
        This method updates the store so that it contains only the given entries.
        Specified by:
        resetEntries in interface RosterStore
        Parameters:
        items - the entries to store
        version - the new roster version
        Returns:
        True if successful
      • resetStore

        public void resetStore()
        Description copied from interface: RosterStore
        Reset the store by removing all entries and setting the version to the empty String.
        Specified by:
        resetStore in interface RosterStore