public class DynamicRosterTest extends Object implements DynamicRosterIfc
Constructor and Description |
---|
DynamicRosterTest() |
Modifier and Type | Method and Description |
---|---|
JID[] |
getBuddies(XMPPResourceConnection session)
getBuddies method returns String array with all roster buddies JIDs. |
Element |
getBuddyItem(XMPPResourceConnection session,
JID buddy)
getBuddyItem method returns buddy item element for a given JID or null if the buddy
doesn't exist on the user roster list. |
Element |
getItemExtraData(Element item)
Returns a new roster Item element with additional, non-standard information for a given item.
|
List<Element> |
getRosterItems(XMPPResourceConnection session)
getRosterItems method returns a full list with all buddies generated by this dynamic roster
implementation. |
void |
init(Map<String,Object> props)
init method is used to provide configuration parameters and initialize the object. |
void |
init(String par)
init method is called at the initialization time when simple form of startup parameters are used:
sess-man/plugins-conf/class-name.init=configuration-string
The configuration-string is passed to this init(...) |
void |
setItemExtraData(Element item) |
public JID[] getBuddies(XMPPResourceConnection session) throws NotAuthorizedException
DynamicRosterIfc
getBuddies
method returns String
array 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.getBuddies
in interface DynamicRosterIfc
session
- a XMPPResourceConnection
value of the connection session object.String[]
array of bare JIDs for the dynamic part of the user roster.NotAuthorizedException
- may be thrown if the connection session is not yet authenticated but authorization
is required to access roster data.public Element getBuddyItem(XMPPResourceConnection session, JID buddy) throws NotAuthorizedException
DynamicRosterIfc
getBuddyItem
method returns buddy item element for a given JID or null
if the buddy
doesn't exist on the user roster list.getBuddyItem
in interface DynamicRosterIfc
session
- a XMPPResourceConnection
value of the connection session object.buddy
- a String
value of the buddy JID. It may be bare JID or full JID.Element
value 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)});
NotAuthorizedException
- may be thrown if the connection session is not yet authenticated but authorization
is required to access roster data.public Element getItemExtraData(Element item)
DynamicRosterIfc
getItemExtraData
in interface DynamicRosterIfc
item
- is a Element
Element
public List<Element> getRosterItems(XMPPResourceConnection session) throws NotAuthorizedException
DynamicRosterIfc
getRosterItems
method 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 at getBuddyItem(...)
description
for details how to create an Element entry for the roster item. getBuddies(...)
method and then for each entry from the array call the
getBuddyItem(...)
. 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.getRosterItems
in interface DynamicRosterIfc
session
- a XMPPResourceConnection
value of the connection session object.List<Element>
valueNotAuthorizedException
- may be thrown if the connection session is not yet authenticated but authorization
is required to access roster data.public void init(Map<String,Object> props)
DynamicRosterIfc
init
method 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's init(...)
method is called but it might be used straight away after the method has
finished.init
in interface DynamicRosterIfc
props
- a Map<String, Object> props
is a configuration parameters map in the form: key:value exactly
as they were specified in the configuration file.public void init(String par)
DynamicRosterIfc
init
method is called at the initialization time when simple form of startup parameters are used:
sess-man/plugins-conf/class-name.init=configuration-stringThe
configuration-string
is passed to this init(...)
method in exact form as it was
found in the configuration file.init
in interface DynamicRosterIfc
par
- a String
value of the configuration string.public void setItemExtraData(Element item)
setItemExtraData
in interface DynamicRosterIfc
Copyright © 2004–2020 "Tigase, Inc.". All rights reserved.