|
Openfire 3.9.0 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jivesoftware.openfire.roster.Roster
public class Roster
A roster is a list of users that the user wishes to know if they are online.
Rosters are similar to buddy groups in popular IM clients. The Roster class is a representation of the roster data.
Updates to this roster is effectively a change to the user's roster. To reflect this, the changes to this class will automatically update the persistently stored roster, as well as send out update announcements to all logged in user sessions.
Field Summary | |
---|---|
protected ConcurrentHashMap<String,Set<String>> |
implicitFrom
Contacts with subscription FROM that only exist due to shared groups key: jabberid string; value: groups why the implicit roster item exists (aka invisibleSharedGroups). |
protected ConcurrentHashMap<String,RosterItem> |
rosterItems
Roster item cache - table: key jabberid string; value roster item. |
Constructor Summary | |
---|---|
Roster()
Constructor added for Externalizable. |
Method Summary | |
---|---|
void |
broadcast(RosterItem item,
boolean optimize)
Broadcasts the RosterItem to all the connected resources of this user. |
void |
broadcastPresence(org.xmpp.packet.Presence packet)
Broadcast the presence update to all subscribers of the roter. |
RosterItem |
createRosterItem(org.xmpp.packet.JID user,
boolean push,
boolean persistent)
Create a new item to the roster. |
RosterItem |
createRosterItem(org.xmpp.packet.JID user,
String nickname,
List<String> groups,
boolean push,
boolean persistent)
Create a new item to the roster. |
void |
createRosterItem(org.xmpp.packet.Roster.Item item)
Create a new item to the roster based as a copy of the given item. |
RosterItem |
deleteRosterItem(org.xmpp.packet.JID user,
boolean doChecking)
Remove a user from the roster. |
int |
getCachedSize()
Returns the approximate size of the Object in bytes. |
org.xmpp.packet.Roster |
getReset()
Obtain a 'roster reset', a snapshot of the full cached roster as an Roster. |
RosterItem |
getRosterItem(org.xmpp.packet.JID user)
Returns the roster item that is associated with the specified JID. |
Collection<RosterItem> |
getRosterItems()
Returns a collection of users in this roster. |
String |
getUsername()
Return the username of the user or chatbot that owns this roster. |
boolean |
isRosterItem(org.xmpp.packet.JID user)
Returns true if the specified user is a member of the roster, false otherwise. |
protected RosterItem |
provideRosterItem(org.xmpp.packet.JID user,
String nickname,
List<String> groups,
boolean push,
boolean persistent)
Generate a new RosterItem for use with createRosterItem. |
void |
readExternal(ObjectInput in)
|
void |
updateRosterItem(RosterItem item)
Update an item that is already in the roster. |
void |
writeExternal(ObjectOutput out)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ConcurrentHashMap<String,RosterItem> rosterItems
protected ConcurrentHashMap<String,Set<String>> implicitFrom
Constructor Detail |
---|
public Roster()
Method Detail |
---|
public boolean isRosterItem(org.xmpp.packet.JID user)
user
- the user object to check.
public Collection<RosterItem> getRosterItems()
Note: Roster items with subscription type FROM that exist only because of shared groups are not going to be returned.
public RosterItem getRosterItem(org.xmpp.packet.JID user) throws UserNotFoundException
user
- the XMPPAddress for the roster item to retrieve
UserNotFoundException
- if no roster item was found for the specified JID.public RosterItem createRosterItem(org.xmpp.packet.JID user, boolean push, boolean persistent) throws UserAlreadyExistsException, SharedGroupException
user
- The item to add to the roster.push
- True if the new item must be pushed to the user.persistent
- True if the new roster item should be persisted to the DB.
UserAlreadyExistsException
SharedGroupException
public RosterItem createRosterItem(org.xmpp.packet.JID user, String nickname, List<String> groups, boolean push, boolean persistent) throws UserAlreadyExistsException, SharedGroupException
user
- The item to add to the roster.nickname
- The nickname for the roster entry (can be null).push
- True if the new item must be push to the user.persistent
- True if the new roster item should be persisted to the DB.groups
- The list of groups to assign this roster item to (can be null)
UserAlreadyExistsException
SharedGroupException
public void createRosterItem(org.xmpp.packet.Roster.Item item) throws UserAlreadyExistsException, SharedGroupException
item
- the item to copy and add to the roster.
UserAlreadyExistsException
SharedGroupException
protected RosterItem provideRosterItem(org.xmpp.packet.JID user, String nickname, List<String> groups, boolean push, boolean persistent) throws UserAlreadyExistsException, SharedGroupException
user
- The roster jid address to create the roster item for.nickname
- The nickname to assign the item (or null for none).groups
- The groups the item belongs to (or null for none).push
- True if the new item must be push to the user.persistent
- True if the new roster item should be persisted to the DB.
UserAlreadyExistsException
SharedGroupException
public void updateRosterItem(RosterItem item) throws UserNotFoundException
item
- the item to update in the roster.
UserNotFoundException
- If the roster item for the given user doesn't already existpublic RosterItem deleteRosterItem(org.xmpp.packet.JID user, boolean doChecking) throws SharedGroupException
user
- the user to remove from the roster.doChecking
- flag that indicates if checkings should be done before deleting the user.
SharedGroupException
- if the user to remove belongs to a shared grouppublic String getUsername()
Return the username of the user or chatbot that owns this roster.
public org.xmpp.packet.Roster getReset()
Obtain a 'roster reset', a snapshot of the full cached roster as an Roster.
public void broadcastPresence(org.xmpp.packet.Presence packet)
Broadcast the presence update to all subscribers of the roter.
Any presence change typically results in a broadcast to the roster members.
packet
- The presence packet to broadcastpublic void broadcast(RosterItem item, boolean optimize)
item
- the item to broadcast.optimize
- true indicates that items that exists only because of a shared
group with subscription status FROM will not be sentpublic int getCachedSize() throws CannotCalculateSizeException
Cacheable
getCachedSize
in interface Cacheable
CannotCalculateSizeException
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
|
Openfire 3.9.0 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |