Package tigase.xmpp.impl.roster
Class DynamicRosterTest
java.lang.Object
tigase.xmpp.impl.roster.DynamicRosterTest
- All Implemented Interfaces:
DynamicRosterIfc
Created: Nov 28, 2008 10:27:55 PM
- Author:
- Artur Hefczyc
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionJID[]getBuddies(XMPPResourceConnection session) getBuddiesmethod returnsStringarray with all roster buddies JIDs.getBuddyItem(XMPPResourceConnection session, JID buddy) getBuddyItemmethod returns buddy item element for a given JID ornullif the buddy doesn't exist on the user roster list.getItemExtraData(Element item) Returns a new roster Item element with additional, non-standard information for a given item.getRosterItems(XMPPResourceConnection session) getRosterItemsmethod returns a full list with all buddies generated by this dynamic roster implementation.voidinitmethod is called at the initialization time when simple form of startup parameters are used:voidinitmethod is used to provide configuration parameters and initialize the object.voidsetItemExtraData(Element item)
-
Constructor Details
-
DynamicRosterTest
public DynamicRosterTest()
-
-
Method Details
-
getBuddies
Description copied from interface:DynamicRosterIfcgetBuddiesmethod returnsStringarray with all roster buddies JIDs. Normally they are bare JIDs (without resource part). This method is normally used by presence plugin to send probe and initial presence to all contacts in the dynamic roster.- Specified by:
getBuddiesin interfaceDynamicRosterIfc- Parameters:
session- aXMPPResourceConnectionvalue of the connection session object.- Returns:
- a
String[]array of bare JIDs for the dynamic part of the user roster. - Throws:
NotAuthorizedException- may be thrown if the connection session is not yet authenticated but authorization is required to access roster data.
-
getBuddyItem
public Element getBuddyItem(XMPPResourceConnection session, JID buddy) throws NotAuthorizedException Description copied from interface:DynamicRosterIfcgetBuddyItemmethod returns buddy item element for a given JID ornullif the buddy doesn't exist on the user roster list.- Specified by:
getBuddyItemin interfaceDynamicRosterIfc- Parameters:
session- aXMPPResourceConnectionvalue of the connection session object.buddy- aStringvalue of the buddy JID. It may be bare JID or full JID.- Returns:
- an
Elementvalue of the XML element with all the roster item data - JID, subscription, nick name and groups. Sample code for creating the buddy element could look like this:Element item = new Element("item", new Element[] { new Element("group", "Tigase devs")}, new String[] {"jid", "subscription", "name"}, new String[] {peer, "both", JIDUtils.getNodeNick(peer)}); - Throws:
NotAuthorizedException- may be thrown if the connection session is not yet authenticated but authorization is required to access roster data.
-
getItemExtraData
Description copied from interface:DynamicRosterIfcReturns a new roster Item element with additional, non-standard information for a given item. This is a way to associate custom roster information with a contact.- Specified by:
getItemExtraDatain interfaceDynamicRosterIfc- Parameters:
item- is aElement- Returns:
- a value of
Element
-
getRosterItems
Description copied from interface:DynamicRosterIfcgetRosterItemsmethod returns a full list with all buddies generated by this dynamic roster implementation. The list contains all contacts for the roster with all contacts details - buddy JID, nick name, subscription (typically always both) and groups. Please have a look atgetBuddyItem(...)description for details how to create an Element entry for the roster item.
In theory you could here call thegetBuddies(...)method and then for each entry from the array call thegetBuddyItem(...). I strongly advice to not do it. This is a server with thousands of connected users and possibly thousands of packets going through the server. Think of a performance and execute database query once if possible rather then many times.- Specified by:
getRosterItemsin interfaceDynamicRosterIfc- Parameters:
session- aXMPPResourceConnectionvalue of the connection session object.- Returns:
- a
List<Element>value - Throws:
NotAuthorizedException- may be thrown if the connection session is not yet authenticated but authorization is required to access roster data.
-
init
Description copied from interface:DynamicRosterIfcinitmethod is used to provide configuration parameters and initialize the object. Please have a look at the interface description for more details about configuration parameters. The object is never used before it'sinit(...)method is called but it might be used straight away after the method has finished.- Specified by:
initin interfaceDynamicRosterIfc- Parameters:
props- aMap<String, Object> propsis a configuration parameters map in the form: key:value exactly as they were specified in the configuration file.
-
init
Description copied from interface:DynamicRosterIfcinitmethod is called at the initialization time when simple form of startup parameters are used:sess-man/plugins-conf/class-name.init=configuration-string
Theconfiguration-stringis passed to thisinit(...)method in exact form as it was found in the configuration file.- Specified by:
initin interfaceDynamicRosterIfc- Parameters:
par- aStringvalue of the configuration string.
-
setItemExtraData
- Specified by:
setItemExtraDatain interfaceDynamicRosterIfc
-