public final class DirectoryRosterStore extends java.lang.Object implements RosterStore
Modifier and Type | Method and 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.
|
public static DirectoryRosterStore init(java.io.File baseDir)
baseDir
- The directory to create the store in. The directory should
be emptyDirectoryRosterStore
instance if successful,
null
else.public static DirectoryRosterStore open(java.io.File baseDir)
baseDir
- The directory containing the roster store.DirectoryRosterStore
instance if successful,
null
else.public java.util.List<RosterPacket.Item> getEntries()
RosterStore
null
is returned.getEntries
in interface RosterStore
RosterEntry
or null
.public RosterPacket.Item getEntry(Jid bareJid)
RosterStore
getEntry
in interface RosterStore
bareJid
- The bare JID of the RosterEntryRosterEntry
which belongs to that userpublic java.lang.String getRosterVersion()
RosterStore
getRosterVersion
in interface RosterStore
public boolean addEntry(RosterPacket.Item item, java.lang.String version)
RosterStore
addEntry
in interface RosterStore
item
- the entry to storeversion
- the new roster versionpublic boolean removeEntry(Jid bareJid, java.lang.String version)
RosterStore
removeEntry
in interface RosterStore
bareJid
- The bare JID of the entry to be removedversion
- the new roster versionpublic boolean resetEntries(java.util.Collection<RosterPacket.Item> items, java.lang.String version)
RosterStore
resetEntries
in interface RosterStore
items
- the entries to storeversion
- the new roster versionpublic void resetStore()
RosterStore
resetStore
in interface RosterStore