tigase.jaxmpp.core.client.xmpp.modules.roster
Class RosterStore

java.lang.Object
  extended by tigase.jaxmpp.core.client.xmpp.modules.roster.RosterStore

public class RosterStore
extends Object

Storage for keeping roster.


Nested Class Summary
static interface RosterStore.Predicate
           
 
Field Summary
protected  Set<String> groups
           
protected  Map<BareJID,RosterItem> roster
           
 
Constructor Summary
RosterStore()
           
 
Method Summary
 void add(BareJID jid, String name, AsyncCallback asyncCallback)
          Adds new contact to roster.
 void add(BareJID jid, String name, Collection<String> groups, AsyncCallback asyncCallback)
          Adds new contact to roster.
 void add(BareJID jid, String name, String[] groups, AsyncCallback asyncCallback)
          Adds new contact to roster.
 void clear()
          Clears storage.
 RosterItem get(BareJID jid)
          Returns RosterItem of given bare JID.
 List<RosterItem> getAll()
          Returns all buddies from roster.
 List<RosterItem> getAll(RosterStore.Predicate predicate)
          Returns all roster items selected by selector.
 int getCount()
          Returns number of roster items in storage.
 Collection<? extends String> getGroups()
          Get all known groups of buddies.
 void remove(BareJID jid)
          Removes buddy from roster.
 void removeAll()
           
 void update(RosterItem item)
          Sends changed RosterItem to server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

groups

protected final Set<String> groups

roster

protected final Map<BareJID,RosterItem> roster
Constructor Detail

RosterStore

public RosterStore()
Method Detail

add

public void add(BareJID jid,
                String name,
                AsyncCallback asyncCallback)
         throws XMLException,
                JaxmppException
Adds new contact to roster.

Parameters:
jid - JID of buddy
name - name of buddy
asyncCallback - callback
Throws:
XMLException
JaxmppException

add

public void add(BareJID jid,
                String name,
                Collection<String> groups,
                AsyncCallback asyncCallback)
         throws XMLException,
                JaxmppException
Adds new contact to roster.

Parameters:
jid - JID of buddy
name - name of buddy
groups - collection of groups name
asyncCallback - callback
Throws:
XMLException
JaxmppException

add

public void add(BareJID jid,
                String name,
                String[] groups,
                AsyncCallback asyncCallback)
         throws XMLException,
                JaxmppException
Adds new contact to roster.

Parameters:
jid - JID of buddy
name - name of buddy
groups - array of groups name
asyncCallback - callback
Throws:
XMLException
JaxmppException

clear

public void clear()
Clears storage.


get

public RosterItem get(BareJID jid)
Returns RosterItem of given bare JID.

Parameters:
jid - bare JID.
Returns:
roster item.

getAll

public List<RosterItem> getAll()
Returns all buddies from roster.

Returns:
all roster items.

getAll

public List<RosterItem> getAll(RosterStore.Predicate predicate)
Returns all roster items selected by selector.

Parameters:
predicate - selector.
Returns:
all matched roster items.

getCount

public int getCount()
Returns number of roster items in storage.

Returns:
number of roster items in storage.

getGroups

public Collection<? extends String> getGroups()
Get all known groups of buddies.

Returns:
collection of group names.

remove

public void remove(BareJID jid)
            throws JaxmppException
Removes buddy from roster.

Parameters:
jid - jid of buddy to remove.
Throws:
JaxmppException

removeAll

public void removeAll()

update

public void update(RosterItem item)
            throws JaxmppException
Sends changed RosterItem to server.

Parameters:
item - changed roster item.
Throws:
JaxmppException


Copyright © 2006-2013 Tigase. All Rights Reserved.