blob: 8c5f386e21406be509b0255454d1c3fdcf2992f1 [file] [log] [blame]
Shuyi Chend7955ce2013-05-22 14:51:55 -07001package org.jivesoftware.smack;
2
3import java.util.List;
4
5import org.jivesoftware.smack.packet.RosterPacket;
6
7/**
8 * This is an interface for persistent roster storage needed to implement XEP-0237
9 * @author Till Klocke
10 *
11 */
12
13public interface RosterStorage {
14
15 /**
16 * This method returns a List object with all RosterEntries contained in this store.
17 * @return List object with all entries in local roster storage
18 */
19 public List<RosterPacket.Item> getEntries();
20 /**
21 * This method returns the RosterEntry which belongs to a specific user.
22 * @param bareJid The bare JID of the RosterEntry
23 * @return The RosterEntry which belongs to that user
24 */
25 public RosterPacket.Item getEntry(String bareJid);
26 /**
27 * Returns the number of entries in this roster store
28 * @return the number of entries
29 */
30 public int getEntryCount();
31 /**
32 * This methos returns the version number as specified by the "ver" attribute
33 * of the local store. Should return an emtpy string if store is empty.
34 * @return local roster version
35 */
36 public String getRosterVersion();
37 /**
38 * This method stores a new RosterEntry in this store or overrides an existing one.
39 * If ver is null an IllegalArgumentException should be thrown.
40 * @param entry the entry to save
41 * @param ver the version this roster push contained
42 */
43 public void addEntry(RosterPacket.Item item, String ver);
44 /**
45 * Removes an entry from the persistent storage
46 * @param bareJid The bare JID of the entry to be removed
47 */
48 public void removeEntry(String bareJid);
49 /**
50 * Update an entry which has been modified locally
51 * @param entry the entry to be updated
52 */
53 public void updateLocalEntry(RosterPacket.Item item);
54}